这里的新推动开发者。 在我的第一个函数上,try / catch正在捕获错误“Null” 不知道最近发生了什么。这是一个Blackberry Webworks Push,在现场设备上使用新的SDK进行测试。
!DOCTYPE HTML PUBLIC“ - // W3C // DTD XHTML 1.0 Transitional // EN”> HTML> 头> meta name =“viewport”id =“viewport”content =“height = device-height,width = device-width,user-scalable = no”/> 标题>推送监听器 script type =“text / javascript”>
var port = 30326;
var serverUrl =“http://pushapi.eval.blackberry.com/”;
var appId =“110319-8h9l07kk5r230i30204846MM95345R721”;
var max = 100;
var wakeUpPage =“Home.htm”;
function openBISPushListener() {
try {
var ops = {port : port, appId : appId, serverUrl : serverUrl, wakeUpPage : 'Home.htm', maxQueueCap : max};
blackberry.push.openBISPushListener(ops, onData, onRegister, onSimChange);
}
catch (err) {
alert(err); ...................... ERROR HAPPENS HERE.......................................
}
}
function onRegister(status) {
//alert("onRegister");
if (status == 0) {
alert("success");
}
else if (status == 1) {
alert("network error");
}
else if (status == 2) {
alert("rejected by server");
}
else if (status == 3) {
alert("invalid parameters");
}
else if (status == -1) {
alert("general error");
}
else {
alert("unknown status");
}
}
function onData(data) {
var resultDiv = document.getElementById("resultDiv");
try {
resultDiv.innerHTML += "<br>" + blackberry.utils.blobToString(data.payload);
return 0; //indicate acceptance of payload for reliable push
}
catch (err) {
alert("err2");
}
}
function onSimChange() {
var resultDiv = document.getElementById("resultDiv");
resultDiv.innerHTML += "<br>" + "SIM card is changed!";
}
</script>
</head>
<body onload="openBISPushListener();">
<div id="resultDiv">
</div>
<p>
To see if the push is working</p>
<p>
</p>
</body>
</html>
答案 0 :(得分:0)
它是.com var serverUrl =“http://pushapi.eval.blackberry.com/”后的斜杠;