Created
February 5, 2015 19:15
-
-
Save joshbuchea/9653a1ea63d0661c012c to your computer and use it in GitHub Desktop.
Cordova - window.alert → Native Notifications
This file contains 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
document.addEventListener('deviceready', function () { | |
if (navigator.notification) { // Override default HTML alert with native dialog | |
window.alert = function (message) { | |
navigator.notification.alert( | |
message, // message | |
null, // callback | |
"Notification Title", // title | |
'OK' // buttonName | |
); | |
}; | |
} | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This snippet requires adding the native dialogs plugin to your project: