Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

How to force close an app on Android?

WeitinWeitin Posts: 44
Brain Burst
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);
ca.Call("startActivity", launchIntent);
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()?
Wei Tin Yuen, VR Developer  B)
Toronto, Canada


  • WeitinWeitin Posts: 44
    Brain Burst
    So it turns out Application.Quit() is the reason my games are crashing when I load them after the first time. Application.Quit() on Android seems to exit the app, but doesn't fully remove the app which is causing the crashing behaviour. Use this instead:
    Wei Tin Yuen, VR Developer  B)
    Toronto, Canada
Sign In or Register to comment.