Question

In order to understand how the Push service in BlackBerry is implemented, I have installed the Push Service SDK and following the Push_Service_SDK-Getting_Started_Guide. Following ths steps thoroughly, on "Registering" myself from the app, I got the following error:

Request to register failed. Caused by java.io.IOException: Network operation [Subscribe] failed. Make sure that Content Provider URL is accesible. 

Can anyone guide me through this. When keying in the details, we need to provide the "BPS server URL" and "Push Initiator application URL". I have received the credential details from BlackBerry and it contains PPG Base Url as "cpXXX.pushapi.eval.blackberry.com" where the XX needs to be replaced by the CPID (Content Provider ID). Is this link to be keyed in for "BPS server URL" and "Push Initiator application URL"? I did key in this and received the above error on "Register".

Please guide.

Was it helpful?

Solution

You should have received a mail with your credentials for both server app and blackberry client app. For the client app, they should look like this:

    Application ID: <CPID(4 chars)>-<id(35 chars)>
    PPG Base URL: http://cpXXX.pushapi.eval.blackberry.com
    Push Port: <port(5 chars)>

As you can see, the App id has two parts. The prefix before the dash is your CPID, and the rest is the id. Then we have an URL where we will need to replace the XXX with the CPID (note that the CPID usually is a 4 digit number, so it would have been better if they had used XXXX as placeholder). Finally the port number which has up to 5 digits.

With those params, in your BB app, you would code something like this:

    String id = "<your full app id here>";
    String url = "http://cp<CPID>.pushapi.eval.blackberry.com"; //Make sure it is http and not https, and check you have replaced <CPID> with the appid prefix.
    int port = <port>;
    byte serverType = <PushApplicationDescriptor.SERVER_TYPE_BPAS or
                        PushApplicationDescriptor.SERVER_TYPE_NONE>;

    ApplicationDescriptor descriptor = ApplicationDescriptor.currentApplicationDescriptor();
    PushApplicationDescriptor pushDescriptor = new PushApplicationDescriptor(id, port, url, serverType, descriptor);

    // This is how we would register the client app:
    PushApplicationRegistry.registerApplication(pushDescriptor);

After executing that line, if everything is ok (registration needs some time, a few connections are made), you can check the registration status calling PushApplicationRegistry.getStatus or via the onStatusChange callback.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top