Tuesday, April 12, 2011

BlackBerry BIS Push Samples

The BlackBerry Push Service is a powerful tool of the real-time experience of BlackBerry smartphones. It offers an efficient and reliable way of sending information to your users. It also allows your application to process information in the background and alert users.

RIM provided some sample push applications for both the BES and BIS cases. Since BIS case is more complicated, I will elaborate the procedure here in this post. I will also mention some frequent problems the developers experienced and the solutions or workarounds for those issues.

1. Install and configure a MySQL database following this instruction: http://docs.blackberry.com/en/developers/deliverables/24182/Installing_MySQL_in_Windows_1241571_11.jsp

2. Download JDBC driver following this instruction:

http://docs.blackberry.com/en/developers/deliverables/24182/Download_JDBC_driver_for_MySQL_1220461_11.jsp

3. Install the BlackBerry Push SDK following this instruction:

http://docs.blackberry.com/en/developers/deliverables/24182/Run_the_BPSS_setup_application_1229036_11.jsp

4. Verify the push server is setup correctly following this instruction:

http://docs.blackberry.com/en/developers/deliverables/24182/Verifying_that_push_server_configured_correctly_1227911_11.jsp

5. Install the sample push-enabled application on the BlackBerry device following this instruction:

http://docs.blackberry.com/en/developers/deliverables/24182/Install_the_client-side_sample_app_to_device_1015009_11.jsp

6. From Step 5, the settings in the device-side application are:

(1) Port: the push port number in RIM’s registration email

(2) App ID: the App ID in RIM’s registration email

(3) BPAS URL: http://pushapi.eval.blackberry.com (already defined in the settings)

(4) Content Provider URL: https://:8443/sample-push-initiator

7. When you register your device to the push server, if you get an error:

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

Reason: The Content Provider URL is not accessible from the device.

Solutions:

1. First of all, try the content provider url in your device browser, make sure it is accessible.

2. If it is not accessible, there are some workarounds you can try:

(1) Workaround 1: Make your content provider URL public, for example: https://abcsystems.com:8443/sample-push-initiator

(2) Workaround 2: For development purposes, if your BlackBerry device is registered on BES, you can try the following steps:

i. Step 1: Add the SSL certificate to your MDS following this instruction: http://www.blackberry.com/btsc/search.do?cmd=displayKC&docType=kc&externalId=KB11623

ii. Step 2: Make sure after the certificate is added to the MDS, you can access the content provider URL from your BlackBerry browser

iii. Step 3: Extract the “sample-push-enabled-app” source jar and create a project with the same source codes under your development environment

iv. Step 4: Change the codes in “PushUtils.java” as follows:

private static String getConnectionSuffix() {

return ";deviceside=false";}

Notes: This workaround will make sure you use the MDS to connect the content provider URL which is a local server.

v. Setp 5: Rebuild the sample-push-enabled-app and download it to your BES-enabled BlackBerry device. Configure the settings following:

http://docs.blackberry.com/en/developers/deliverables/24182/Install_the_client-side_sample_app_to_device_1015009_11.jsp

Now you should be able to run the sample-push-initiator on your local server and the sample-push-enabled-app on your device with the push-and-receive ability setup.

Enjoy!

2 comments:

  1. Hi, Could you help me?
    I've tried it but the sample push app doesn't work on my real phone. When I register my device to my push server I got the error:
    "Request to register failed. Caused by java.io.IOException: Network operation [Subscribe] failed. Make sure that Content Provider URL is accessible."

    This is a BIS case, The content provider is accesible from the device browser.

    Thanks

    ReplyDelete
  2. I am using the BIS one. I have made it to public URL. but it seems doesn't working at all. any suggestion?

    ReplyDelete