Sencha Touch 2.1.0 in native app format,how to show a confirm dialog before app exits
I have package touch app to android native app format,I want to show a query dialog before the app will exit,and if the use answer no,I want to abort the quiting process(then the app remaind running).
How should I do ?
I'm sorry but you can't!
This is not a ST related issue, but you would have the same problem developing a native iOS / Android app.
Eventually you could detect when an app execution has been set in background mode, but nothing more, if you try to think, have you ever seen an app asking yourself if you really want to quit using an hardware button?
Hope this helps.
I have to disagree! It may not be possible for iOS (no hw back button), but certainly for Android. Only ST2.1 doesn't have support for the BACK button in a native packaged app. So for the time being one would have to use PhoneGap to do that.
Originally Posted by AndreaCammarata
Then you should have asked:
Originally Posted by ingo.hefti
"Is it possible to intercept the back button on Android?"
Don't forget that the user can quit an app using the Home button on Android too and even in this case, it's not possible to intercept the event to display a warning message as you requested.
The best you can do in this case is intercept the onStop(), onPause() and onDestroy() events to perform some application actions before the app close but this doesn't solve your problem anyway.