Reputation:
My problem is the alert is never shown on navigator.notification.alert
... but it is shown when I do window.alert
...
Please see the code below :
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready", onDeviceReady, true);
function onDeviceReady() {
// Empty
}
function myFunction()
{
/* navigator.notification.alert(
'You are the winner!', // message
alertDismissed, // callback
'Game Over', // title
'Done' // buttonName
);*/ // NOT WORKING
window.alert ('Hello World!') ; // WORKS !!
}
</script>
</head>
<body>
<button onclick="myFunction()">Try it</button>
</body>
</html>
Upvotes: 1
Views: 1817
Reputation: 3672
Have you put
<plugin name="Notification" value="org.apache.cordova.Notification"/>
in app/res/xml/config.xml ??
Upvotes: 1
Reputation: 822
To use the notifications, you have to install the notification plugin. Navigate in your phonegap root directory und type:
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
From now on, you should be able to use the notification alert. :)
Upvotes: 2