我已经按照文档成功实现了所有内容,并让我的设备注册了 pushwoosh:
这是代码:
<script>
document.addEventListener("deviceready", onDeviceReady, false);
var pushNotification;
function onDeviceReady() {
pushNotification = window.plugins.pushNotification;
pushNotification.register
(successHandler, errorHandler,{"senderID":"10524986381","ecb":"onNotificationGCM"});
}
function onNotificationGCM(e) {
switch( e.event )
{
case 'registered':
if ( e.regid.length > 0 )
{
PushWoosh.appCode = "F653A-0888C";
PushWoosh.register(e.regid, function(data) {
alert("PushWoosh register success: " + JSON.stringify(data));
}, function(errorregistration) {
alert("Couldn't register with PushWoosh" + errorregistration);
});
}
break;
}
}
function successHandler (result) {
}
function errorHandler (error) {
}
</script>
但不幸的是,一旦发送,我就无法在设备上接收 PushNotifications。
请帮忙,谢谢!