HTTP push sample app
The HTTP push sample application demonstrates how to push content to a BlackBerry device and how to listen for pushed content on a BlackBerry device.
The sample application provides both a server-side application that you can use to send content to a BlackBerry Smartphone Simulator or BlackBerry device and a client-side application that listens for pushed content on a BlackBerry device.
This file contains the main method, which starts the application, the HTTPPushDemo class, which creates and adds the UI components to the main screen, and the inner class, ListeningThread, which accepts the push request and receives the data from the server-side application.
This file is the server-side application, which pushes the data to the BlackBerry device or the BlackBerry Smartphone Simulator which runs the client-side application. This application is a standard JFrame application that runs on your computer.
This file is a DOS script that compiles and runs the server-side application.
This sample features the following classes:
This class is a push input stream specifically for use with the BlackBerry MDS Connection Service.
The sample application uses this class to accept and acknowledge the push request from the BlackBerry MDS Connection Service.
Install the sample application
Visit http://www.blackberry.com/go/httppushsampleapp to download the sample application.
Extract the httppushdemo.zip file.
On the taskbar, click Start > Programs > Research In Motion > BlackBerry JDE 4.7.0 > JDE.
Open the workspace that you want to add the sample application to.
In the workspace tree, right-click the project that you want to add the sample application to.
Click Add project to <workspace directory>.
In the Add project to <workspace> dialog box, browse to the folder where you extracted the sample application.
Click the HTTPPushDemo.jdp file.
Run the sample application
To make sure that the application delivers the push data to the correct application, you must complete Steps 6 to 9. Before the BlackBerry MDS Simulator can successfully deliver push data with application acknowledgement, it must determine whether the BlackBerry Smartphone Simulator supports application-level reliability. This support is determined by using the BlackBerry Smartphone Simulator to retrieve a web page through the BlackBerry MDS Simulator.
In C:\Program Files\Research In Motion\BlackBerry Email and MDS Services Simulators 4.1.5\MDS\config, open the rimpublic.property file in a text editor.
In the rimpublic.property file, verify that the line push.application.reliable.ports=100 is not commented out. If it is commented out, remove the comments.
On the taskbar, click Start > Applications > Research in Motion > BlackBerry Email and MDS Services Simulators > MDS to start the BlackBerry MDS Simulator.
On the taskbar, click Start > Applications > Research In Motion > BlackBerry JDE 4.6.0 > JDE to open the BlackBerry Java Development Environment.
Press F5 to build the open projects and start the BlackBerry Smartphone Simulator.
In the BlackBerry Smartphone Simulator, click the Browser icon.
In the web address field, type a web address.
Press the Enter key.
Close the browser.
On the Home screen of the BlackBerry Smartphone Simulator, click the Downloads folder.
Click HTTP Push Demo.
On your computer, browse to the folder where you extracted the sample application.
In the server folder, double-click run.bat to open the server-side sample application.
In the sample application, in the top field, type a message.
To set the protocol that the application should use when it sends data, select the rim or pap option.
In the BlackBerry Smartphone Simulator, click OK.
The message that the server-side application sends is rendered on the client-side application in the BlackBerry Smartphone Simulator.