我已经测试过使用cordova-1.8.1.js和推送插件与pushwoosh.com一起发送推送通知,它可以正常工作。
我跟着这个教程:http://www.pushwoosh.com/programming-push-notification/push-notification-sdk-integration-for-phonegap/
推送通知发送到我的 iPhone,它会播放声音并在手机和应用程序关闭时显示通知,很好!
但是,如果我在通知可见时打开手机,则应用程序会按原样打开……但是
显示的警报说:
警报
"push-notification","{\aps\":\sound\":\"default\",\"alert\":\"然后是消息....\"}}”
此外,如果我删除带有主页按钮的应用程序并再次启动它,我会收到另一个警报,说“注册设备”、“类型”:“7”......等等。
2. 我怎样才能让它消失?
任何输入appeciated,谢谢!
最佳答案
问题解决了。使用它,它只会在警报中显示消息,而不会显示其他信息。
document.addEventListener('push-notification', function(event) {
//console.warn('push-notification!: ' + event.notification);
//navigator.notification.alert(JSON.stringify(['push-notification1!', event.notification]));
var notification = JSON.parse(event.notification);
navigator.notification.alert(notification.aps.alert);
//pushNotification.setApplicationIconBadgeNumber(0);
pushNotification.setApplicationIconBadgeNumber(0);
});
关于push-notification - 使用 phonegap 推送通知 - cordova push plugin 和 pushwoosh.com,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11241529/