Ensuring Android app restarts every time
I want my Android app to restart every time rather than resume. I have found a couple of variations of code and wanted to check which is the recommended code?
Basically the difference is where the listener is added
i.e
stage.addEventListener(Event.DEACTIVATE, onDeactivateApp);
OR
NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, onDeactivateApp);
function onDeactivateApp(event:Event):void {
NativeApplication.nativeApplication.exit();
}
I have tested NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, onDeactivateApp); on my Nexus 7 and it appears to do what I require but just want to be sure this is a catch all solution and that nothing else is required.
