Return to Snippet

Revision: 34848
at October 29, 2010 02:18 by sidneydekoning


Initial Code
// Check if we are on a Android / iPhoney device.
if(Capabilities.cpuArchitecture=="ARM")
{
	NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, handleActivate, false, 0, true);
	NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, handleDeactivate, false, 0, true);
	NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys, false, 0, true);
}

private function handleActivate(event:Event):void
{
	NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
}
 
private function handleDeactivate(event:Event):void
{
	NativeApplication.nativeApplication.exit();
}
 
private function handleKeys(event:KeyboardEvent):void
{
	if(event.keyCode == Keyboard.BACK)
	NativeApplication.nativeApplication.exit();
}

Initial URL

                                

Initial Description
For your Air for Android application to properly close you need to define some handlers and respond to them.

Initial Title
Exit you application AIR for ANDROID

Initial Tags
android

Initial Language
ActionScript 3