Question

And I wonder if is possible to open an specific action I mean for example open a new mail in the gmail application, or new message on whatsapp stuff like that.

I'm trying to lunch application's specific actions within my application, so it interacts with a couple of more applications.

if is possible how to achieve that.

so far I do can lunch the application with the package name.

or get the package list from getInstalledPackages but I cant find that there be published the application actions.

is that dependent on the application ?

as well I know that I can do something like:

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");

to prompt the user for a selection (if not default) for that action. but I cant find related information to lunch the app skiping the users input.

I hope this be possible at least for the most popular applications.

Was it helpful?

Solution

The getInstalledPackages almost contains all you can get from PackageManager about an application. But it doesn't contain the intents of each components. In particular, ActivityInfo doesn't contain a field to store the intent or action to start it. As far as I know, it is difficult to get what you want programatically.

But for popular application, you can directly have their apks, get their AndroidManifest.xml and get what you want manually.

If you want to skip the user input if multiple components(applications) can handle your action, then you need to specify the component explicitly by intent.setComponent().

Intent intent = new Intent(Intent.ACTION_NAME);
intent.setComponent(new ComponentName("com.package.address","com.package.address.TargetActivity"));
startActivity(intent);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top