Adobe AIR native extension

Access to application options and device information

The extension is available here: com.distriqt.Application


Application State Events

The AIR standard ACTIVATE and DEACTIVATE events will inform your application when the AIR application loses focus. This is often used to stop application rendering and other operations that you wish to perform when your application enters the background or returns to the foreground.

However these events will not completely inform you of when your application enters the background or foreground, as these events can be triggered when other elements are overlaid on your application, such as dialogs or even the iOS control center. In these cases generally you don’t want to deactivate your application as your application is still running in the foreground.

Instead if you wish to only monitor when your application enters the background either by being minimised or by the device being closed you can use the ApplicationStateEvents.

There are also ACTIVATE and DEACTIVATE events here to be able to monitor the complete lifecycle from a single location:


On Android there are a few manifest additions to add to be able to correctly monitor your entire application state.

The following will need to be added into the <application> node of your manifest additions. You will need to replace APPLICATION_PACKAGE with your AIR applications Java package name. Generally this is your application id prefixed with air..

    android:multiprocess="true" />


Listening for the events is a very simple process, simply add the event listener to the Application singleton.

Application.service.addEventListener( ApplicationStateEvent.ACTIVATE, stateEventHandler );
Application.service.addEventListener( ApplicationStateEvent.DEACTIVATE, stateEventHandler );
Application.service.addEventListener( ApplicationStateEvent.FOREGROUND, stateEventHandler );
Application.service.addEventListener( ApplicationStateEvent.BACKGROUND, stateEventHandler );

function stateEventHandler( event:ApplicationStateEvent ):void
    trace( event.type + "::" + event.code );

    if (event.type == ApplicationStateEvent.BACKGROUND)
        // Your application is in the background
    if (event.type == ApplicationStateEvent.FOREGROUND)
        // Your application is in the foreground