Reputation: 2030
Actually I have this code to get all the apps that offer an Intent with a full specified action name.
public List<ResolveInfo> getAll() {
Intent intent = new Intent("com.example.intent.A");
final PackageManager mgr = mContext.getPackageManager();
List<ResolveInfo> list = mgr.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
return list;
}
How can I get all the apps that offer custom Intents with an action name specified by a pattern?
I would specify only the first part of the action name, something like com.example.intent.*, and then get all the app that respond to the intent:
It's important to note that this application doesn't know the full names of the intent.
Upvotes: 1
Views: 267
Reputation: 95578
I agree with @CommonsWare on this. It is not possible. Android supports Intent resolution by exact matching of ACTION strings, so it doesn't need to support the functionality that you want.
Theoretically you could request a list of all installed packages from the PackageManager
and then scan through all the activities in each package looking at the ActivityInfo
objects and the associated Intent filters. Unfortunately, there is no way to get the Intent filters associated with an activity (this was conveniently left out of the ActivityInfo
class).
Upvotes: 1