Last active
August 29, 2015 14:17
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This isn't designed to stop the operation but allow you to determine the method by which your application was deactivated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried it but home and lock buttons still work. Should I describe anything into manifest related to this function?