05-23-2024 05:40 AM
I've implemented a native Android plugin that I call from Unity C# script to start another application using an intent like so:
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName);
if (launchIntent != null) {
Log.d(TAG, "Launching package: " + packageName);
context.startActivity(launchIntent);
} else {
Log.e(TAG, "Package not found: " + packageName);
}
Regardless of package name, it is never found (I can verify that the package indeed is installed and is listed using 'pm list packages' using adb shell. This makes me believe Meta has restricted the use of intents to start other installed applications?
Seeing the developer documentation is pretty much toilet in general I wonder if anyone knows if this is even possible? I do find some posts suggesting it at least has worked in the past but I cannot get this to work. Anyone knows?
Solved! Go to Solution.
05-24-2024 08:49 AM
As a good citizen I will provide the solution. Since Android 11 you need to query for visibility on some intents. This can be done on different levels. I choose to use QUERY_ALL_PACKAGES.
Not sure how this affects reviews but for my use case it works fine.
Read more here:
https://medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9
https://developer.android.com/about/versions/11/privacy/package-visibility#all-apps
05-24-2024 08:49 AM
As a good citizen I will provide the solution. Since Android 11 you need to query for visibility on some intents. This can be done on different levels. I choose to use QUERY_ALL_PACKAGES.
Not sure how this affects reviews but for my use case it works fine.
Read more here:
https://medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9
https://developer.android.com/about/versions/11/privacy/package-visibility#all-apps