开发者

Error "Null" in Simple blackberry Push

开发者 https://www.devze.com 2023-04-06 17:31 出处:网络
New push developer here. On my first function the try/catch is catching the error \"Null\" Not sure whats going on.This is a Blackberry Webworks Push with the new SDK on a live device for testing.

New push developer here. On my first function the try/catch is catching the error "Null" Not sure whats going on. This is a Blackberry Webworks Push with the new SDK on a live device for testing.

!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> html> head> meta name="viewport" id="viewport" content="height=device-height,width=device-width,user-scalable=no" /> title>Push Listener 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 accepta开发者_StackOverflownce 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>
        &nbsp;</p>

</body>
</html>


Its the slash after the .com var serverUrl = "http://pushapi.eval.blackberry.com/";

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号