phonegap notification 的sample有点坑爹哇,与想象的有点差距其实就是个弹出对话框。
如图:
[img]http://dl.iteye.com/upload/attachment/0075/9897/7012cbac-aac9-31ed-b34e-530228f391f2.png[/img]
index.html
如图:
[img]http://dl.iteye.com/upload/attachment/0075/9897/7012cbac-aac9-31ed-b34e-530228f391f2.png[/img]
index.html
<!DOCTYPE html>
<html>
<head>
<title>Notification Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
// Empty
}
// alert dialog dismissed
function alertDismissed() {
// do something
}
// Show a custom alertDismissed
//
function showAlert() {
navigator.notification.alert(
'You are the winner!', // message
alertDismissed, // callback
'Game Over', // title
'Done' // buttonName
);
}
</script>
</head>
<body>
<p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p>
</body>
</html>