vethetheth Posted June 2, 2022 Share Posted June 2, 2022 Hi. I have different applications that call themselves through code. I use a launcher that launches an app, the app then launch the launcher, and the launcher calls another app. I am experiencing random crashes and I think it is because i don't quit / call the apps correctly. Is there a way to do it properly through WAVE code ? I am using unity What I want is do it properly : I am in the launcher, i want to quit the launcher, then launch the app. Quit the app, then launch the launcher etc... I need to completely quit my game : the Unity Application.Quit() doesn't "kill the application" so I had to use these lines of codes. Thanks in advance. Here is my code to launch a game : public static void NextGame(string gameName) { AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject ca = up.GetStatic<AndroidJavaObject>("currentActivity"); AndroidJavaObject packageManager = ca.Call<AndroidJavaObject>("getPackageManager"); AndroidJavaObject launchIntent = packageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage", gameName); ca.Call("finishAndRemoveTask"); ca.Call("startActivity", launchIntent); up.Dispose(); ca.Dispose(); packageManager.Dispose(); launchIntent.Dispose(); } And to stop it : public static void StopGame() { AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject ca = up.GetStatic<AndroidJavaObject>("currentActivity"); ca.Call("finishAndRemoveTask"); up.Dispose(); ca.Dispose(); } Link to comment Share on other sites More sharing options...
vethetheth Posted June 7, 2022 Author Share Posted June 7, 2022 Bump. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now