For some reason (known bug in Unity 2018.3 for Android) Google Play services stops working after Application.Quit() is used. More information on this here: Application.Quit () makes it unstable on Android · Issue #310 · playgameservices/play-games-plugin-for-unity · GitHub
I finally got play services to work after using the work around suggested there which was to replace Application.Quit() with below:
using (AndroidJavaClass javaClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) {
AndroidJavaObject unityActivity = javaClass.GetStatic<AndroidJavaObject>("currentActivity");
unityActivity.Call<bool>("moveTaskToBack", true);
}
But this is a hack and minimizes the app. I need it to quit.
I tried the other command suggested there:
System.Diagnostics.Process.GetCurrentProcess().Kill();
But that does not do anything.
This bug was fixed in Unity 2018.4 but I’m at the deployment stage of my game, beta testing is done and am about to go public and at this stage I just cannot update Unity and risk breaking anything.
So any way to make the app quit without using Application.Quit()?
Thanks