Pushing data down to your BlackBerry Widget


In a world demanding constant access to data and quicker updates for their applications, what could be better than real time push data from your server? BlackBerry push technology is one of the cornerstones of the BlackBerry® solution which is used to proactively deliver emails, calendar entries and live data down to the smartphone.

The Push Service is comprised of three components:

  1. The server side push application: Using the WAP 2.2 standard, the server component which is used to host and push data down to the smartphone.
  2. Client side application: The application installed on a user’s BlackBerry smartphone which listens for a push coming from the server.
  3. The BlackBerry Infrastructure: Provides the middleware that receives requests to push data from the content provider, and then delivers the given data to the associated client application on the BlackBerry smartphone.

Until recently this functionality was only available to Java developers for the BlackBerry platform. Using the BlackBerry Widget SDK, a web developer can easily leverage the BlackBerry push technology to keep their BlackBerry Widget up to date with real time data.  Using the JavaScript API’s, a web developer can open a port to listen for pushed data on start up, and set an event handler for when that data is pushed down to the application. The event will be fired once the application detects that data has been sent to the device and you’ll be able to handle that data in real time. With that data, you can update the onboard SQLite database, update the UI of the application, store that data in a flat file or use it in whichever way you see fit.

Here’s a code example of how to leverage data:

var port = 100;

function subscribe() {
//open the listener to listen if there is pushed data coming through
blackberry.push.openPushListener(handleReturnData, port);

//handleReturnData – the function to call for the event of pushed data coming through
function handleReturnData(data) {
var text = blackberry.utils.blobToString(data.payload);
//do something with the text that was pushed…

//stop listening for pushed data, a clean up step
function unsubscribe() {

The BlackBerry Widget SDK really simplifies the process of utilizing the BlackBerry push technology, and allows you to keep data up to date in real time.  Finance, news, sports and gaming are just some of the fields that could benefit by providing real time updates and pushing them down to the device.

One of the other major benefits of utilizing BlackBerry push technology is that your application no longer needs to poll a server to see if there’s new data.  By pushing data down to the device, instead of polling, your application will save bandwidth usage, and battery life making your application more user-friendly.

I hope that you’ll take a look at the push lab posted on the BlackBerry Developer website to develop your own BlackBerry Widget utilizing the BlackBerry push technology.

Join the conversation

Show comments Hide comments
+ -
  • http://www.dogizmo.com/gadget/widget-using-push-against-mr-eval widget using push against mr. eval « DoGizmo.com

    […] I just modified a little bit the code of the blog entry and it works the LAB example with a simluator. After a while I got my access information for the […]

blog comments powered by Disqus