Respond to a change in application state

The BlackBerry 10 OS application window has three states, and the state of the application window can change at any time. For example, a BlackBerry device user may minimize an application to open another application or to close the minimized application. Your application should listen for changes to the state of the application window and respond accordingly. Your application should save the application state and stop any unnecessary processes to preserve system resources. When the user reactivates your application, you can load the saved state, and restart any suspended processes. The IowWindowEvent class defines the events that are associated with a change in the application window state.




The application window is maximized on the BlackBerry device and is active.


The application window is a thumbnail on the home screen and is not active. This state happens when a user minimizes the application or is switching between applications.


The application window is not visible. This state happens when another application is maximized.

Listen for a change in the window state

How to

Listen for changes in the application window state.


In your public class,  define the instance for the application state.

var win:IowWindow = IowWindow.getAirWindow();

In the constructor, set up an event listener to listen for a change in application window state.

win.addEventListener(IowWindowEvent.WINDOW_STATE_CHANGED, stateChanged );

Define a stateChanged function that is called when the application window state changes.

function stateChanged(event:IowWindowEvent):void
         case IowWindowState.NORMAL:
            trace("Application is full screen");
         case IowWindowState.THUMBNAIL: 
            trace("App is minimized");
         case IowWindowState.HIDDEN:
            trace("App is hidden");

Build requirements

import qnx.display.*;


Use the stateChanged function to perform the appropiate actions for each state of your application.

You can use trace comments to test and troubleshoot your application. The debug console in Adobe Flash Builder or Powerflasher FDT displays trace comments when testing your application in the debug configuration.