Skip to content

Instantly share code, notes, and snippets.

@marchbold
Last active August 29, 2015 14:17
Show Gist options
  • Save marchbold/84a02160905e5e4a0a1d to your computer and use it in GitHub Desktop.
Save marchbold/84a02160905e5e4a0a1d to your computer and use it in GitHub Desktop.
Determine if the user deactivated your app via the home or lock button
Application.init( APPLICATION_KEY );
if (Application.isSupported)
{
Application.service.addEventListener( ApplicationStateEvent.DEACTIVATE, application_deactivateHandler );
}
function application_deactivateHandler( event:ApplicationStateEvent ):void
{
switch (event.code)
{
case ApplicationStateEvent.CODE_HOME:
// home button was pressed
break;
case ApplicationStateEvent.CODE_LOCK:
// lock button was pressed
break;
}
}
// com.distriqt.Application
@barisonal
Copy link

I tried it but home and lock buttons still work. Should I describe anything into manifest related to this function?

@marchbold
Copy link
Author

This isn't designed to stop the operation but allow you to determine the method by which your application was deactivated.

@marchbold
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment