Hi, I would like my app to shut itself down when suspended.
The app starts in under a second normally, so the user won't notice much difference between starting/resuming the app.
I tried to "Application:exit()" in the Suspend event listener, but that does really not do what i want. The app goes to suspend, and when I re-enter it, directly goes back to suspend. (can repeat this infinitely)
Is there a way to do this as I imagine?
Comments
In this code, all my objects get initiated once and then start running with the calculated values, which are based on os.time()
It would be really really hard for me at this time to refactor everything so it can be initiated everytime the app resumes. Altough I know "coding it better" would be the right solution, I would rather have the option to not allow the app to be in the background and instead just exit it every time.
I just replaced Application:exit() with application:exit()
Dunno why i got no error message before. But yeah, if anyone comes across this, putting application:exit() into the stage:addEventListener(Event.APPLICATION_SUSPEND, function() works as i needed it on Android.
Likes: ar2rsawseen
As far as i know according to IOS policy you can not use aplication.exit() in your code.