Skip to content

Instantly share code, notes, and snippets.

@sjmach
Last active December 11, 2015 07:09
Show Gist options
  • Save sjmach/4564671 to your computer and use it in GitHub Desktop.
Save sjmach/4564671 to your computer and use it in GitHub Desktop.
This code is to show the user a close Dialog box in Phonegap or Apache Cordova for android devices in Android. If the user clocks Yes then the application exits
function showConfirm() {
navigator.notification.confirm(
'Do you really want to exit?', // message
exitFromApp, // callback to invoke with index of button pressed
'Exit', // title
'Cancel,OK' // buttonLabels
);
}
function exitFromApp(buttonIndex) {
if (buttonIndex==2){
navigator.app.exitApp();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment