diff --git a/mobile/android/thirdparty/com/leanplum/LeanplumPushService.java b/mobile/android/thirdparty/com/leanplum/LeanplumPushService.java index f711b86702d1..d0e1daf87c08 100644 --- a/mobile/android/thirdparty/com/leanplum/LeanplumPushService.java +++ b/mobile/android/thirdparty/com/leanplum/LeanplumPushService.java @@ -475,13 +475,21 @@ public class LeanplumPushService { * Checks if there is some activity that can handle intent. */ private static Boolean activityHasIntent(Context context, Intent deepLinkIntent) { + final int flag; + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { + flag = PackageManager.MATCH_ALL; + } else { + flag = 0; + } List resolveInfoList = - context.getPackageManager().queryIntentActivities(deepLinkIntent, 0); + context.getPackageManager().queryIntentActivities(deepLinkIntent, flag); if (resolveInfoList != null && !resolveInfoList.isEmpty()) { for (ResolveInfo resolveInfo : resolveInfoList) { if (resolveInfo != null && resolveInfo.activityInfo != null && resolveInfo.activityInfo.name != null) { - if (resolveInfo.activityInfo.name.contains(context.getPackageName())) { + // In local build, Fennec's activityInfo.packagename is org.mozilla.fennec_ + // But activityInfo.name is org.mozilla.Gecko.App. Thus we should use packagename here. + if (resolveInfo.activityInfo.packageName.equals(context.getPackageName())) { // If url can be handled by current app - set package name to intent, so url will be // open by current app. Skip chooser dialog. deepLinkIntent.setPackage(resolveInfo.activityInfo.packageName);