BlackBerry
Skip Top Navigation
Developers Partners
North America [change region] Products Solutions Purchasing Support
Developers


Pushing Content to the BlackBerry Browser

Exercise

Build an HTTP PUSH server using either Java or .NET; this server will have the capability to push to the BlackBerry® Browser.

Objectives

  • To gain experience using BlackBerry MDS and push.
  • Discover how to use a simple HTTP connection to initiate a PUSH
  • Review the three Browser PUSH types:
    • Channel Push
    • Cache Push
    • Message Push

Setup

Java version:
  1. Download the file
  2. Open the directory: “Workspaces\Incomplete\BlackBerry Web Content\Browser Push\Java”
  3. Open the HttpPushWorker.java source file
  4. Open the PushUI.java source file
NET version:
  1. Download the file
  2. In Visual Studio .net, open the project found in the directory: “Workspaces\Incomplete\BlackBerry Web Content\Browser Push\dotNet”
  3. Open the HttpWorker.cs file

Tasks

  1. Select either the Java or .NET version of the server to work with.
  2. Complete the httpPush Method
    1. Create an HTTP connection to read from the source webpage
    2. Once the source is read, create an HTTP connection to do the PUSH
    3. Add the necessary PUSH headers, as well as any important headers from the source page (such as Content-Type)
    4. Write the data from the source page to the output part of the Push connection.
    5. Read the response from the server
    6. Close any open Connections, Streams or Readers

Check Your Work

Download the completed code (Java)
Download the completed code (dotNet)

Review

In this exercise, you discovered the following things:

  • gained experience using BlackBerry MDS and push.
  • to initiate a PUSH through a simple HTTP connection.
  • the three Browser PUSH types: Channel Push, Cache Push, Message Push


Additional Labs

Go to the first exercise in “Security for BlackBerry Applications”, Basic encryption and decryption

Back to the Developer Lab Main Menu

 
Other Resources
 
     
 Home | Products | Solutions | Purchasing | Support | Developers | Worldwide | News | About Us | Contact Us | Site Map
 Legal | Copyright © 2008 Research In Motion Limited, unless otherwise noted.