我正在尝试在我的 phonegap 应用程序中为 bb os 6 和 7 实施推送通知
之后显示错误警报,我也无法在设备上收到推送通知。
我正在使用 pushwoosh 服务器发送通知请建议这里出了什么问题是我的代码
var port = 33981; //THE_PORT_FROM_BB_REGISTRATION;
var serverUrl = "http://pushapi.eval.blackberry.com";
var appId = "4223-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
var max = 100;
var wakeUpPage = "index.html";
function openBISPushListener() {
try {
var ops = {port : port, appId : appId, serverUrl : serverUrl, wakeUpPage : wakeUpPage, maxQueueCap : max};
//alert("obj = " + ops.wakeUpPage);
alert(blackberry.push.openBISPushListener(ops, onData, onRegister, onSimChange));
alert("success push");
}
catch (err) {
alert("Called openBISPushListener():Error - " + err);
//alert(err);
}
}
function onRegister(status) {
alert("status" + status);
if (status == 0) {
PushWoosh.register(function(data) {
alert("PushWoosh register success: " + JSON.stringify(data));
}, function(errorregistration) {
alert("Couldn't register with PushWoosh" + errorregistration);
});
}
else if (status == 1) {
alert("push register status network error");
}
else if (status == 2) {
alert("push register status rejected by server");
}
else if (status == 3) {
alert("push register status invalid parameters");
}
else if (status == -1) {
alert("push register status general error");
}
else {
alert("push register status unknown");
}
}
function onData(data) {
alert("Push notifications received. Data is " + blackberry.utils.blobToString(data.payload));
try {
return 0; //indicate acceptance of payload for reliable push
}
catch (err) {
alert("Called onData():Error - " + err);
}
}
function onSimChange() {
//handle Sim Card change
alert("sim changed");
}