import android.content.pm.ResolveInfo; import android.content.ComponentName; import android.content.pm.ActivityInfo; Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); List<ResolveInfo> pkgAppsList = UnityPlayer.currentActivity.getPackageManager().queryIntentActivities( mainIntent, 0); Log.d("Deeplink", String.valueOf(pkgAppsList.size())); for(ResolveInfo info : pkgAppsList) { ActivityInfo activity = info.activityInfo; Log.d("Deeplink", String.valueOf(activity.applicationInfo.packageName)); if(activity.applicationInfo.packageName.contains("your app bundle id")) { ComponentName name = new ComponentName(activity.applicationInfo.packageName,activity.name); Intent i = new Intent(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_LAUNCHER); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); i.setComponent(name); UnityPlayer.currentActivity.startActivity(i); Log.d("Deeplink", "Launching Intent"); } }
Find installed Apps on Android and Start the intent
Subscribe to:
Posts (Atom)