When looking at the ResolveInfo
return from resolveActivity()
and queryIntentActivities()
,
why the ResolveInfo
is different from these two calls for the same intent?
the viewIntent
is Intent(Intent.ACTION_VIEW, Uri.parse(deeplinkData)
, and the one returned from resolveActivity has unrelated packagename/name:
ResolveInfo info = pm.resolveActivity(viewIntent, PackageManager.MATCH_DEFAULT_ONLY);
System.out.println("+++ 111 resolveActivity(), info.activityInfo.packageName: "+info.activityInfo.packageName+",\ninfo.activityInfo.name: "+info.activityInfo.name);
it has log:
+++ 111 resolveActivity(), info.activityInfo.packageName: android,
info.activityInfo.name: com.android.internal.app.ResolverActivity
where using queryIntentActivities
List<ResolveInfo> resInfo = pm.queryIntentActivities(viewIntent, 0);
if (!resInfo.isEmpty()){
for (ResolveInfo info : resInfo) {
System.out.println("+++ queryIntentActivities(), info.activityInfo.packageName: "+ (info.activityInfo.packageName));
System.out.println("+++ +++ queryIntentActivities(), info.activityInfo.name: "+ (info.activityInfo.name));
......
}
}
has log:
+++ queryIntentActivities(), info.activityInfo.packageName: com.client.android.debug
+++ +++ queryIntentActivities(), info.activityInfo.name: com.client.android.NewsActivity
+++ queryIntentActivities(), info.activityInfo.packageName: com.android.chrome
+++ +++ queryIntentActivities(), info.activityInfo.name: com.google.android.apps.chrome.IntentDispatcher
resolveActivity()
returns the component that would be started if you call startActivity()
. That will be:
null
if there is no match or you are not set up package visibility rules on Android 11+In your case, you are getting the chooser activity (com.android.internal.app.ResolverActivity
).