cordova - Unable to get Phonegap notifications working using AngularJs -
i'm using angularjs starter app phonegap , testing on android phone (4.03) . app starts fine , following code in received event runs , correctly routes views. isn't happening notification alert i've added
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 navigator.* don't navigator.notification.alert( 'you winner!', // message 'game over', // title 'done' // buttonname ); navigator.notification.beep(2); console.log('received event: ' + id); } };
you need include callback alert -
navigator.notification.alert( 'you winner!', // message callbackfunction, // callback 'game over', // title 'done' // buttonname ); that should work...
Comments
Post a Comment