To Kill or Pause an iOS App (when it’s Deactivated)

When an app is deactivated on iOS you can kill it instead of allowing it to continue running in the background (background running is the default behavior). Use the UIApplicationExitsOnSuspend property in the application configuration XML file:
Adobe doc*

* please note the revised syntax and description from Holly Schinksy:

Here’s a couple of discussions on the Adobe forum:

On Android, you can respond to the Deactivation event from the system and call NativeApplication.nativeApplication.exit() before your application is deactivated. Apple apps don’t seem to respond to the nativeApplication.exit() method.

import flash.desktop.NativeApplication;
// ...
NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, handleDeactivate, false, 0, true);
// ...
private function handleDeactivate( event:Event ) : void 

Be careful if you try this on BlackBerry’s PlayBook. I submitted an app that did this and it was rejected for it. You may have success submitting an app with auto-close if you explain that it is the intended behavior.

Note that there is some debate about the preferred action when an app is Deactivated. Some prefer to allow it to go into an idle mode that uses little system resources (called Tombstoning), while others prefer to kill the app outright. Here’s a blog post from “fjenning” at Adobe on Tombstoning:

EDIT: 3/24/2012
I recently found that when using the NativeApplication.nativeApplication.exit(); method and testing the SWF in the Flash Player Debugger, an error was thrown because the SWF was running outside an AIR environment. The same SWF showed no errors when running inside an AIR environment. I wrapped the line in a try/catch statement to solve the problem.

Leave a Reply