I have an application built using sencha-touch & phonegap but I don't know how to add exit/stop function to exit the application. After looking arround in google and other sites I got clue to use navigator.app.exitApp()
but it didn't work.
How can I solve this?
Note : I'm using - phonegap 1.3 - sencha touch 1.1 - Galaxy tab
Thanks in advance
Please try following code, it is working fine in my app:
document.addEventListener("exitButton",function(){
navigator.notification.confirm(
'Do you want to quit',
onConfirmQuit,
'QUIT TITLE',
'OK,Cancel'
);
}, true);
function onConfirmQuit(button){
if(button == "1"){
navigator.app.exitApp();
}
}
Put something like this in the HTML file:
<a href="#" onClick="closeMeNow();" data-role="button">Close App</a>
That links to a function like this in your JS file:
function closeMeNow() {
navigator.app.exitApp();
}
I know the syntax is more JQM than Sencha, but since the concept is basically the same you can just edit where is needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With