Gracefully exiting app (android os)

Hi fellow programmers,

Just curious, how everyone is exiting their apps (android)
(windows 7 64)…

I read some where, that some apps were getting rejected due to
a exit button in their menus.

Checking after installing on my Droid II and Kindle, after pressing
the device back button the app is showing up in running apps
I do use a couple of mem/app killing programs that kill all
running apps in background…
Is there a graceful way of exiting, when back button is pressed?

I currently use the following code with no problems that I can
see:

Used in my main.lua file

--outside and above the main() function  
  
function onSystemEvent( event )  
  
 if "applicationExit" == event.type then  
  
 os.exit();  
  
 end  
  
return 0;  
  
end  
  
-- outside and below the main() function in main.lua (at the bottom)  
  
Runtime:addEventListener( "system", onSystemEvent );  

Thanks :slight_smile:
Larry
“Follow Your Dreams!” [import]uid: 107633 topic_id: 21264 reply_id: 321264[/import]

You can use native.requestExit() instead of os.exit(). That willl exit the app gracefully, instead of forced.

Hope this helps. [import]uid: 117906 topic_id: 21264 reply_id: 84405[/import]