Wednesday, April 27, 2011

BES-Push: Setup Trusted Connections to BlackBerry MDS

To permit push applications to make trusted connections (SSL) to a BlackBerry MDS Connection Service, some preparation steps are required to be done beforehand. Follow the setup procedure as follows:

1. Enable Push Encryption from the BlackBerry Administration Service

· Open the BlackBerry Administration Service Web Console

· Go to “Servers and Components” section

· Expand “BlackBerry Solution Topology”

· Expand “Component View” under “BlackBerry Domain”

· Expand “MDS Connection Service”

· Click on the MDS instance to which your push application is connected

· In the “Instance information” tab, make sure the port number which the BlackBerry devices open to listen to the push messages is defined under the “Ports enabled for reliable pushes” section

· In the “Instance information” tab, enable “Push Encryption” under the “Access Control” section by setting the value to “Yes”

· Switch to the “General” tab, make sure the “Web server listen port” and “Web server SSL listen port” are defined and there are no conflicts with the port numbers

· Restart the MDS-CS instance

· Notes: More information is available at: http://docs.blackberry.com/en/admin/deliverables/12107/Restricting_push_content_users_receive_on_devices_268662_11.jsp#Restrict_push_apps_from_sending_data_to_devices_547121_11

2. Import the BlackBerry MDS Connection Service to the key store of a push application by following this instruction:

· http://docs.blackberry.com/en/admin/deliverables/12107/Allowing_push_apps_trusted_connections_to_MDSCS_268652_11.jsp

· Notes:

i. For the last part in the instruction, which is to import the certificate to the push application, make sure the certificate is imported to the key store of the Java JRE which is being used by your push application

ii. In the step of adding the certificate to the key store, make sure you have the permission to change the key store file

iii. If the certificate is not correctly imported, a similar error will be thrown as “Unable to find valid certification path to requested target

Now the push application is able to send SSL push request to the BlackBerry devices through MDS.

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!