我正在使用AngularJs入门应用程序进行手机屏幕并在Android手机上测试(4.03)。应用程序启动正常,接收事件中的以下代码运行并正确路由视图。没有发生的是我添加的通知提醒
var app = {
initialize: function() {
this.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function() {
app.receivedEvent('deviceready');
},
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
//the next 2 calls to navigator.* don't do anything
navigator.notification.alert(
'You are the winner!', // message
'Game Over', // title
'Done' // buttonName
);
navigator.notification.beep(2);
console.log('Received Event: ' + id);
}
};
答案 0 :(得分:1)
您需要为警报添加回调 -
navigator.notification.alert(
'You are the winner!', // message
callbackFunction, // Callback
'Game Over', // title
'Done' // buttonName
);
这应该有用......