How to get list of activities with specific intent action

Viewed 260

How i can get list of activities for any intent action?

for example we have intent with action SEND or intent with action SEND_MULTIPLE. How i can get list of packages for intents with this action and some extras,to it work in android 11? Thanks everybody for the help.

1 Answers

What you're looking for is the queryIntentActivities from the PackageManager:

Retrieve all activities that can be performed for the given intent.

For example for the SEND action, you would do the following:

    PackageManager packageManager = getPackageManager();
    Intent intent = new Intent(Intent.ACTION_SEND, null);
    List<ResolveInfo> result = packageManager.queryIntentActivities(intent, 0);
Related