Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
Instant app exit! Need confirmation how to do?
-
Hello there, i’ve compiled my HTML5 game, everything’s ok.
Engine: Rpg Maker MV.
I just need a confirmation when user press quit button, because now is istantanely.
I add Cordova Notification plugin (cordova dialog plugin)
Then in my project i’ve create a JS file like this:document.addEventListener("backbutton", function (e) { e.preventDefault(); navigator.notification.confirm("Are you sure want to exit from App?", onConfirmExit, "Confirmation", "Yes,No"); }, false); function onConfirmExit(button) { if (button == 2) { //If User select a No, then return back; return; } else { navigator.app.exitApp(); // If user select a Yes, quit from the app. } }
But it doesn’t work.
I’ve also try to put in
<script> JS CODE </script>
On my Index.html
And nothing…
Where i’m wrong?
Thanks
-
@lakaroth said in Instant app exit! Need confirmation how to do?:
document.addEventListener(“backbutton”, function (e) {
e.preventDefault();
navigator.notification.confirm(“Are you sure want to exit from App?”, onConfirmExit, “Confirmation”, “Yes,No”);
}, false);Try:
$(document).on(“click”, “#backbutton”, function (e) {
navigator.notification.confirm(“Are you sure want to exit from App?”, onConfirmExit, “Confirmation”, “Yes,No”);
}, false);