The New BlackBerry Development Environment

Analysis: The new RIM BlackBerry devices, including the Storm, come with a host of new and exciting features. Now RIM is rolling out a software development kit for the BlackBerry that lets Java developers take advantage of these features.

In the computing world, the hardware is often a step or two ahead of the software. The simple reason is that once the hardware is released, it takes time before software developers start creating applications for the new hardware.

Such is the case with BlackBerry. However, the latest versions of the Blackberry devices-including the Storm-now have an SDK (software development kit) that lets Java developers create software that takes advantage of all the great new features in the BlackBerry.

For example, the Storm has a lot of cool new features, including an accelerometer-a built-in motion sensing device that lets the Storm know what angle it's being held at relative to the ground so that the screen can automatically rotate 90 degrees when you hold the Storm in your hand.

Additionally, the Storm features a full-size touch screen, unlike previous BlackBerry models that divided the front of the device between screen and keyboard, as well as other new features.

To accommodate these new features, Research In Motion, which manufactures the BlackBerry, has released a beta version of the new SDK, including programmatic support for the new features. In this article I'll look at what's available in the new SDK, including some new and some not-so-new features.

Accelerometer Support

The motion-sensing devices seem to be all the craze these days, and I'm one person who has fallen for it, having recently bought a Nintendo Wii. Although mobile devices such as the Storm use a totally different technology from the Wii (the Wii uses infrared transmitters and software triangulation), as well as Apple's iPhone (which has a patent), the end result is the same cool feeling that the device somehow knows where it is relative to the Planet Earth. (I tried to get information on how the one in the Storm works by searching the online U.S. Patent database. I quickly became frustrated after discovering that RIM has nearly 1,200 patent applications in process that haven't yet been approved. However, I did locate a patent application that seems to describe it. If you're curious, go here and search patent applications for publication number 20080034321.)

To accommodate the accelerometer, the SDK includes APIs for detecting both the orientation of the device (either the top is up, or the left side is up), and the acceleration of the device. By detecting the device's orientation, your application can change its orientation between portrait and landscape accordingly. In addition, by sensing acceleration, your application can detect movement along all three coordinates in space.

The only stickler is that the application shouldn't constantly poll the accelerometer. According to the documentation, the accelerometer takes a great deal of battery power, and shouldn't be on constantly. This is because when an application opens a channel to the accelerometer device, the BlackBerry continuously polls the motion sensors. Therefore, your application should poll it periodically only as needed. (Although I suppose in the case of a game, a user would need to poll at a high rate to keep up with user movements. The key there is for the user to open a connection to the motion sensor, get the data, and immediately close the connection. Then on the next poll, do the same thing.)

Finally, the Storm has built-in capabilities to turn the screen sideways when the device moves. The application can query the current orientation, and even turn off this default behavior.

Touchscreen Support

The APIs include support for the touchscreen. The device can detect when the user pushes on the touchscreen, when the user moves the finger across the touchscreen, and when the user lets go of the touchscreen. Additionally, the device can capture events for gestures, and even double-taps (the latter of which is missing on a lot of touchscreen devices).

What's interesting about the Storm's touchscreen is that not only can a user touch it like any other touchscreen, they can actually push on it, and the screen will click like a large button. When I first heard about this, I thought that was a little odd, but it actually has a great benefit in the way of not accidentally clicking when you don't want to. The software in turn can respond to just touches as well as clicks of the screen. At a low level, a user can receive events for pushing a click on the screen, and letting go of a click on the screen.

The touchscreen includes a built-in on-screen keyboard that the application can also make use of. In addition to simply reading text from the keyboard, the application can control the keyboard itself. The application can determine if the keyboard is visible, and can also display or hide the keyboard.