How to properly close Android application.

I would like to know the proper way of closing an Android app. If I click the back button it seems to close by itself but it remains running in the background.

Viewing 1 to 4 (4 Total)
How to properly close Android application.

jesusgumbau

jesusgumbau
Total Posts: 14
Joined: March 19, 2012

I would like to know the proper way of closing an Android app. If I click the back button it seems to close by itself but it remains running in the background.

Tags:
Posted on July 30, 2012 at 7:51 AM

Philippe

Philippe
Total Posts: 261
Joined: September 08, 2011

Re: How to properly close Android application.

In general, you shouldn't.

However you should do something when your receive the DEACTIVATE / ACTIVATE events:
http://www.joshuagranick.com/blog/2012/07/23/stage-focus-and-activa...

Posted on July 30, 2012 at 8:02 AM

plicatibu

plicatibu
Total Posts: 72
Joined: March 18, 2012

Re: How to properly close Android application.

jesusgumbau, even if you where developing for Android using it's SDK, you're not able to close your application.

At most you call finish() on Android to let it know you're done with the app.

With NME just call Lib.exit() to notify android you want to quit your app.

When Android see it needs more memory it kills background apps.

Posted on July 30, 2012 at 4:53 PM

Huge

Huge
Total Posts: 548
Joined: October 07, 2011

Re: How to properly close Android application.

I think I might need to tweak the back operation a bit.
Currently, it works pretty much like the 'home' key, but for other apps, the back buttons seems a bit more violent.
It might need a bit more research.

But either way, you should respond to the DEACTIVATE to allow for the case of the user hitting the home key, and later the OS evicting you from the process list.

Hugh

Posted on July 31, 2012 at 12:56 AM