Android using Application.Quit

Hi Everyone,

I’m having trouble having my Android game quitting the game correctly. This is what I do…

function OnApplicationPause() {
Application.Quit();
}

This is what happens, I can run the game and hit the home button. Then when I go ahead and choose to run the app again, the screen turns black like it is about to load the game and then it quits out. If I press it again then it runs like a fresh start.

In short: Application.Quit doesn’t really quit completely.

Is there any way to really quit the game?

maybe you can make a button for testing. If you hit the button that does Application.Quit(); and see if it is working the same.
because on many games on android if i push the home button it still runs in background. I mostly use pushing the back button two times in the menu of the game. then it quits

Application.Quit(); works fine for me. There should be something wrong with your code.

I can confirm that Application.Quit() works fine also for me, I use it when the BACK hw key menu button is pressed

Thanks to everyone for your responses.

This helped me use the back button now. I didn’t even realize that Android phones had that feature in there apps. This still however leaves the home button issue.

Is there a way to disable multitasking or to catch the Home Button hardware key so I can do a Application.Quit()?

Android does not give developers access to the Home HW key in that sense as it would mess with the application lifecycle. The only thing you can do with the HOME key is give an activity the following intent filter in your manifest:

<category android:name="android.intent.category.HOME" />

All this will do, however, is give the user the option to make this Activity the default activity to run when pressing the HOME key. It will not give you the results you desire.