I'm trying to use an app to launch another app using the following code.
AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject ca = up.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject packageManager = ca.Call<AndroidJavaObject>("getPackageManager");
launchIntent = packageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage",bundleId);
I'll call this app the launcher and the other apps are games.
I can launch games from the launcher correctly, however I noticed the launcher app will still have a running instance (when returning from games and loading through Oculus home menu). The Oculus Quest basically only allows you to run one app at a time, which confuses me. Using the same code, I can load the launcher where I left off with no problems. But once I've launched a game, return to the launcher, then try to launch the same game, it says "AppName has stopped". I think the related error I get is: 'Consumer closed input channel or an error occurred. events=0x9'
I think a solution is to force close an app when I load the new app. How can I properly do this? Application.Quit()?