Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Trusted Contributor
Posts: 103
Registered: ‎03-31-2011
My Device: Curve 9330
My Carrier: Verizon

Response CODE: 2000 Error on registering for push.

Hello

I get this error message.

Our PUSH-ID: 1316101573.5437
PUSH-ID: 1316101573.5437
REPLY-TIME: 2011-09-15T15:46:48Z
Response CODE: 2000
Response DESC: No Active Subscribers for the Push Service

 

back from server side.

It looks as if my phone app is not subscribing.  But I cannot tell what I am doing wrong.  It looks almost identical to the API docs.

 

function init(){
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);
    }     
  } 

  function onRegister(status) {
    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");
    if (data != null) {
                        blackberry.app.setHomeScreenIcon('local:///imgs/iShopIconNew.png');
                        var text = blackberry.utils.blobToString(data.payload);
                        document.getElementById("txtHint").innerHTML=text;
                        setCookie("newinfo",text,365);
                        //alert("text recieved from push: " + text);
                    } else {
                        //alert("No data from the push");
                        setCookie("newinfo","0",365);
    try {
      resultDiv.innerHTML += "<br>" + blackberry.utils.blobToString(data.payload);
      return 0; //indicate acceptance of payload for reliable push
    } 
    catch (err) {
      alert(err);
    }
  }

  function onSimChange() {
    var resultDiv = document.getElementById("resultDiv");
    resultDiv.innerHTML += "<br>" + "SIM card is changed!";
  }
}

 

Trusted Contributor
Posts: 103
Registered: ‎03-31-2011
My Device: Curve 9330
My Carrier: Verizon

Re: Response CODE: 2000 Error on registering for push.

then I read this http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/new-push-api/td-p/1312825
and it registers automatically. So what does that mean? That my php code is wrong?
Developer
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
My Carrier: O2

Re: Response CODE: 2000 Error on registering for push.

[ Edited ]

according to the message:

Response DESC: No Active Subscribers for the Push Service

 the phone does not register with the push service. You do this with a real Blackberry? Did you ever saw a alert window that shows "success"? This should popup when the registration with the push service was successful.



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Trusted Contributor
Posts: 103
Registered: ‎03-31-2011
My Device: Curve 9330
My Carrier: Verizon

Re: Response CODE: 2000 Error on registering for push.

[ Edited ]

Yes this is on a real phone  curve9330.  I am running this code in a function init()  that runs on body load of a page that is set to run as the Background Start page.    No I never see an alert message.

 

 

Do I need to call any functions in my body onload?

Developer
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
My Carrier: O2

Re: Response CODE: 2000 Error on registering for push.

[ Edited ]

you need to call openBISPushListener(); and remove the init thing. What do you wanted to do whith it?



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Trusted Contributor
Posts: 103
Registered: ‎03-31-2011
My Device: Curve 9330
My Carrier: Verizon

Re: Response CODE: 2000 Error on registering for push.

[ Edited ]

Smiley Sad   Still not working. 

I have given permissons for:

     blackberry.app

     blackberry.push

     blackberry.utils

     blackberry.invoke

I am using visual Studio :  This is done on a htm page called BackgroundPage.htm.   I have it set as my Background start page with the " Run automatically on install and device startup" checked

 

I get no alerts to show.  

 

This  is my new code:

<!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</title>
<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);
      alert("running pushlistener");
    }
    catch (err) {
      alert(err);
    }     
  } 

  function onRegister(status) {
    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");
    if (data != null) {
                        blackberry.app.setHomeScreenIcon('local:///imgs/iShopIconNew.png');
                        var text = blackberry.utils.blobToString(data.payload);
                        document.getElementById("txtHint").innerHTML=text;
                        setCookie("newinfo",text,365);
                        //alert("text recieved from push: " + text);
                    } else {
                        //alert("No data from the push");
                        setCookie("newinfo","0",365);}
    try {
      resultDiv.innerHTML += "<br>" + blackberry.utils.blobToString(data.payload);
      return 0; //indicate acceptance of payload for reliable push
    } 
    catch (err) {
      alert(err);
    }
  }

  function onSimChange() {
    var resultDiv = document.getElementById("resultDiv");
    resultDiv.innerHTML += "<br>" + "SIM card is changed!";
     } 
          
</script>
	</head>
	<body onload="openBISPushListener()">

	</body>
</html>

 

I found this String registerUrl = "http://pushapi.eval.blackberry.com/mss/PD_subReg?serviceid=<ID_RECEIVED_FROM_RIM>&osversion=6.0.0.246&model=9800;deviceside=true;";


at http://supportforums.blackberry.com/t5/BlackBerry-Push-Development/Blackberry-Push-API-Registeration...   However the comformation email from blackberry never said enything about a PD_subReg?serviceid  needing to be added to the url.  Nor did I see it in any other example.

Developer
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
My Carrier: O2

Re: Response CODE: 2000 Error on registering for push.

The url that you are using is correct. The other url is from Java and has nothing to do with the new webworks 2.1 api. Before adding other stuff to the app you may be want to get a "Success" alert and get the app registered. Sorry but I cant help you there at the moment, because I am stuck at a similiar problem.



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Response CODE: 2000 Error on registering for push.

Are you using the newest SDK, because there is no support for it and the visual studio plugin. THe openBisPushListener API is a new api that will only work in the newer SDKs.



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Trusted Contributor
Posts: 103
Registered: ‎03-31-2011
My Device: Curve 9330
My Carrier: Verizon

Re: Response CODE: 2000 Error on registering for push.

That is what I am thinking. I am downloading the 2.1 webworks sdk as I type. Tell me how do I tell what version I am currently using? And will there be anything special I will have to do to inter-grade it into Visual Studio?
Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Response CODE: 2000 Error on registering for push.

If you just run bbwp.exe without any parameters it should tell you the version number. As per Visual Studio integration, this is no longer supported. Should you wish you can still use the tooling to develop your app but you'll have to use the command line to package.



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)