您好,我目前正在开发我的 ios pushwoosh phonegapp 应用程序。我正在遵循本指南:
我不知道我需要在哪里实现此代码:
In your onDeviceReady function add:
initPushwoosh();
bind: function() {
document.addEventListener('deviceready', this.deviceready, false);
},
deviceready: function() {
// note that this is an event handler so the scope is that of the event
// so we need to call app.report(), and not this.report()
initPushwoosh();
app.report('deviceready');
},
还有这个代码我需要放在同一个文件中吗?接收推送通知。请参阅 initPushwoosh 函数中的以下代码片段
document.addEventListener('push-notification', function(event) {
var notification = event.notification;
navigator.notification.alert(notification.aps.alert);
pushNotification.setApplicationIconBadgeNumber(0);
});