Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Terminate app on suspend? — Gideros Forum

Terminate app on suspend?

HolonistHolonist Member
edited October 2014 in General questions
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

  • My problem is that most of my code lays loosely in files, not objects.
    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.
  • Holy cow, it worked...

    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

    +1 -1 (+1 / -0 )Share on Facebook
  • You already stated that you are working on Android platform but just for your information:
    As far as i know according to IOS policy you can not use aplication.exit() in your code.
Sign In or Register to comment.