Last active
December 11, 2015 07:09
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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