0

I HAVE REEDITED THE QUESTION

I am getting the apps installed in the Android phone with the code below. I put the info of the app in an instance of PInfo (one of my customized class).

Now I want to get one of them and open it passing a parameter, I have tried the following:

Uri uri =Uri.parse("THEURL");
Intent intent = getPackageManager().getLaunchIntentForPackage(((PInfo)apps.get(0)).apppackage);
intent.setData(uri);

startActivity(intent);

This opens the app but how to pass the parameter? (The code above is not working) For example, a string.

0

2 Answers 2

0

Step #1: Get the email address of the developer of the application in question.

Step #2: Ask the developer if they support such a string extra (or data Uri, or whatever). If so, follow what they tell you to do. If not, do not attempt to open their app this way.

Step #3: Repeat Steps #1 and #2 for every app you are interested in.

0

You should create a method that handles the incoming intent and call it within your onCreate or onResume methods.

You'll pass the information like this:

intent.putExtra("foo", someString);

Then you'll try read the information passed along within the intent.

String incomingString = getIntent().getStringExtra("foo"); should do the trick within your handleIncomingIntent()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.