Research in Motion (RIM) offers two ways of writing applications for BlackBerry devices–Native Java, and the Microsoft Visual Studio plugin. As a VB.Net developer, I was tempted to go the Visual Studio plugin approach, but I decided against it for the following reasons:
- It’s geared more towards rapid forms-based applications that communicate by web services.
- It requires the user to be on a BlackBerry Enterprise Server.
- It does not provide access to all of the APIs and BlackBerry features that you get with Java; for example, camera, phone, Bluetooth, address book, GPS, BlackBerry Maps, and BlackBerry Message features.
- It doesn’t support the BlackBerry Storm touch screen and accelerometer.
- Debugging and deployment is more difficult, and the Visual Studio plugin only comes with a BlackBerry Bold simulator. The Java tools come with a BlackBerry Storm simulator.
For these reasons, to be able to debug for the Storm, and to have access to the entire BlackBerry library, I decided to go with the Java approach. The transition is quite easy, once you get the development environment in place and write your first test application. The BlackBerry website has a lot of good information for developers, if you’re able to find it.
I found that this page has everything you need to get started developing BlackBerry applications:
http://na.blackberry.com/eng/developers/resources/tutorials.jsp#tab_tab_development
Rather than copy and paste information from their guides, I’ll just point out some of the things I wish were clearer in each document.
Setting Up Necessary Tools
First you need to install the JDK, as specified in the BlackBerry documentation. However, you can skip the step get the Eclipse IDE. The Eclipse IDE is installed automatically with the BlackBerry Plug-in for Eclipse, which is mentioned in the next step. In addition to the BlackBerry plugin for Eclipse, you’ll need to install the BlackBerry plugin for Eclipse Component Pack 4.7, in order to get the BlackBerry Storm simulator (and target the 4.7 platform), which is available here:
http://na.blackberry.com/eng/developers/javaappdev/javaeclipseplug.jsp
Writing Your First Application
I found the Eclipse environment for Java to be very similar to Visual Studio. If you’ve ever done any JavaScript programming, then you’ll be somewhat familiar with the syntax, and it shouldn’t be too bad to start developing in Java. The “Writing Your First Application” guide from BlackBerry is a great first step to follow along with to create a simple test application or proof of concept. Two things I would add are:
- Creating an icon for your application–It will look much better if you pick one, rather than the default RIM folder icon. Right click on your project in Project Explorer, and choose properties. Click on BlackBerry Project Properties. Click Resources, and “Add,” under Icon Files. You can choose a png, gif, or jpg to use as your icon.
- Creating custom backgrounds and borders–This was hard to find information on. Basically, you have to import these classes:
import net.rim.device.api.ui.decor.BorderFactory;
import net.rim.device.api.ui.decor.BackgroundFactory;
Then you can add code like the following to set a background color or border:
_fieldManagerTop.setBackground(BackgroundFactory.createSolidBackground(Color.LIGHTBLUE));
_MyTextBox.setBorder( BorderFactory.createRoundedBorder(new XYEdges(1, 1, 1, 1) ));
How And When To Sign
I found that any realistic application you would write for a BlackBerry is going to uses classes that are restricted and need signing. Therefore I’d suggest that you apply for the RIM code signing registration keys right away. It took about a week for my keys to be processed.
Deploy And Distribute Applications
I found that using the BlackBerry Desktop Manager’s Application Loader feature worked well for testing purposes, however over the air deployment works best for final deployment of the application to a wider audience.