Skip to main content
Known Participant
February 3, 2013
Question

Ensuring Android app restarts every time

  • February 3, 2013
  • 1 reply
  • 505 views

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.

This topic has been closed for replies.

1 reply

Nabren
Inspiring
February 4, 2013

As far as I know that is the supported and proper way.