Audio and Application Activity

The Android Activity Manager controls applications moving to the foreground or the background based on the user’s decision, but doesn’t terminate them.

When your application goes to the background, most processes are paused, but audio and timers continue to run. Unless you want your audio to keep playing, you need to listen to two events to monitor a play and pause scenario:


import flash.desktop.NativeApplication;
(Event.ACTIVATE, onActivate);
(Event.DEACTIVATE, onDeactivate);
function onDeactivate(event:Event):void {
// pause or stop audio
function onActivate(event:Event):void {
// play audio