您好我正在使用我的ios pushwoosh phonegapp应用程序。我正在关注此guide:
我不知道我需要在哪里实现此代码:
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);
});
答案 0 :(得分:0)
看看这个有关phonegap集成的工作示例: https://github.com/shaders/push-notifications-sdk/tree/master/SDK%20Sample%20Projects/iPhone-Phonegap
和这个javascript文件,它显示了你应该在哪里实现提供的代码: https://github.com/shaders/push-notifications-sdk/blob/master/SDK%20Sample%20Projects/iPhone-Phonegap/www/js/index.js