Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Anonymous's avatar
Anonymous
6 years ago

How to detect app made with unity quit on Oculus Go

Hello everyone, are there anyone know how to detect app quit on Oculus Go? I have tried using OnApplicationQuit(), but it doesn't work. Unfortunately, after googling, there is no luck on what I am looking for. What I would like to do is to save the int with PlayerPref() when app is quit. 

4 Replies

Replies have been turned off for this discussion
  • Anonymous's avatar
    Anonymous
    Already get what i was looking for works, but still would like to know how to save some value when the app quit.
  • Hi we're handling OnApplicationPause to save state instead of OnApplicationQuit for this reason.  
  • OnApplicationPause doesn't get called on forced shutdown due to low battery, so we added this hook to our Android plugin which may be of use to others

     

    public class MyReceiver extends BroadcastReceiver {
        @override
        public void onReceive(Context context, Intent intent) {
            if (action.equals("android.intent.action.ACTION_REQUEST_SHUTDOWN")) {
               UnityPlayer.UnitySendMessage("GlobalGameObject", "AndroidShutdown", "");
            }
        }
    };