Issue
How to know if the intent I am going to publish is going to be answered in advance?
After building an intent, I tried this, which does not work:
Intent fc = ....
PackageManager manager = context.getPackageManager();
List<ResolveInfo> list = manager.queryIntentActivities(fc, 0);
startActivityForResult(fc, 1);
Despite the fact that list
has 0 elements, an app was opened by the intent.
Solution
On Android 11 and higher, to use many (most?) methods on PackageManager
, you need to have a <queries>
element in your manifest, identifying the apps (or criteria for apps) that you want to find via PackageManager
. Without that <queries>
element, the package visibility rules will limit you results to your own app and some system apps.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.