![]() |
Languages »
C / C++ Language »
General
Intermediate
License: The Code Project Open License (CPOL)
Pushing HTML content to a BlackberryBy Steven BerkovitzHow to push HTML content to a blackberry handheld using MDS |
C#, Windows, .NET, ASP.NET, Visual Studio, IIS 5.1, IIS 6, Dev
|
|
Advanced Search |
|
|
|
||||||||||||||||

Blackberry's (developed by Research In Motion - RIM) have become a critical part of many corporate networks including IT, financial and government networks. Their always connected nature and rich content delivery services (through Blackberry Enterprise Server and Mobile Data Service) make them very inviting to developers to develop applications for. Out of the box, you can deliver HTML content to them with very little work. Their Java-based operating system allows for developers to create applications that deliver data in real time and can be interacted with using the devices intuitive user interface and full QWERTY keyboard.
I am going to concentrate on the most simplistic way to delivery content to the device using a HTML browser channel. My next article may include a custom application for the handheld.
In order to use this code you need
The Mobile Data Service is completely HTTP based. You establish an HTTP connection to your Blackberry Enterprise Server (default port is 8300) with some query parameters and POST containing your data. The handheld's browser listens on port 7874 for incoming pushes. Custom Blackberry HTTP headers specify information about the content and how to display it (including read and unread icons, title, etc). For simplicity sakes, I am going to let the handheld use its default icons.
I decided to implement this as a WebService to allow for easy access from other internal applications. The code is pretty straight forward. There is one WebService method and one protected method that handles actually creating the HTTP request and firing it off to the MDS server. Configuration information about the MDS server is held in web.config and can be accessed using the built in ConfigurationSettings.AppSettings collection.
The WebService method has the following signature:
public virtual void PushToBrowser(string[] recipients,
string channelTitle,
string channelName,
string baseLocation,
string message)
To use, create a new application, add a web reference to it (I called mine BesUtils). The code below illustrates how you'd push a simple HTML document to a handheld
BesUtils.MdsPusher pusher = new BesUtils.MdsPusher();
string[] recip = {"steven@mbccs.com"};
try
{
pusher.PushToBrowser(recip, "Hello World", Guid.NewGuid().ToString(),
"", "<html><head></head><body>Hello World.</body></html>");
}
catch(Exception ex)
{
Console.Write(ex.ToString());
}
The image at the top of this article illustrates the icon and text that appears when a new message has been pushed to the handheld. You would click the icon to open the browser and it would take you directly to the document you pushed down.
You need to keep channelName constant if you want the handheld to update the same channel, otherwise a new channel will be created each time you push to the handheld.
| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 7 Dec 2004 Editor: Chris Maunder |
Copyright 2004 by Steven Berkovitz Everything else Copyright © CodeProject, 1999-2009 Web13 | Advertise on the Code Project |