UIApplicationExitsOnSuspend not working on Android

Hi! The UIApplicationExitsOnSuspend for Android is not working build.settings. It workd well with iPhone devices, but on Android, when i go out the app and enter again, it restarts all over again. Can anybody help me with this part.

I don’t know if a have my build.settings for andoird.

Thanks!!!

That is an iOS setting only.  Settings in your “iphone” table are only applied to iOS builds.
 
There isn’t an equivalent to the UIApplicationExitsOnSuspend setting on Android.  But you can mimic that behavior in your code as follows…

local function onSystemEvent(event) if event.type == "applicationSuspend" then native.requestExit() end end Runtime:addEventListener("system", onSystemEvent)

 
 
The native.requestExit() function is only supported on Android.  It will do nothing on iOS.  So, it is safe to leave that line in your code for iOS builds to.  Documentation for this function can be found here…
   http://docs.coronalabs.com/api/library/native/requestExit.html

Thanks a lot!! I’ll try that

That is an iOS setting only.  Settings in your “iphone” table are only applied to iOS builds.
 
There isn’t an equivalent to the UIApplicationExitsOnSuspend setting on Android.  But you can mimic that behavior in your code as follows…

local function onSystemEvent(event) if event.type == "applicationSuspend" then native.requestExit() end end Runtime:addEventListener("system", onSystemEvent)

 
 
The native.requestExit() function is only supported on Android.  It will do nothing on iOS.  So, it is safe to leave that line in your code for iOS builds to.  Documentation for this function can be found here…
   http://docs.coronalabs.com/api/library/native/requestExit.html

Thanks a lot!! I’ll try that

Excellent :slight_smile: Thank you!

I’m using this to make sure interstitial AdMob ads are displayed on Android as well.

Excellent :slight_smile: Thank you!

I’m using this to make sure interstitial AdMob ads are displayed on Android as well.