- Home /
Android service plugin with OnApplicationPause issue
I have a problem with "OnApplicationPause".
I have implemented the code below, When you close an app in the Android Divice by closing the Application window or emptying the memory, or when you open the app again, the Android service you closed appears again. Is there any way to implement it in Unity when the app is terminated for some reason, such as Android's onDestroy?
void OnApplicationPause(bool pauseStatus){
if (!isStart)
return;
Debug.Log ("****** OnApplicationPause Before pauseStatus : " + pauseStatus);
if (pauseStatus && !isPaused) { //onPause()
ajoHelper.Call("startService1");
isPaused = true;
} else { //onResume()
ajoHelper.Call("stopService1");
isPaused = false;
}
}
void OnApplicationQuit() { //onDestory() ??
ajoHelper.Call("stopService1");
isStart = false;
}
Comment