Chapter 1 RI AL Gathering What You Need to Develop BlackBerry Apps TE In This Chapter ▶ Discovering BlackBerry apps and why to develop them MA ▶ Collecting the right tools ▶ Sharpening the right skills D ▶ Meeting the challenges of BlackBerry development TE A RI GH BlackBerry application is meant to be small, fast, and responsive to its users. BlackBerry smartphones are small, fast, and function as mini-communications centers: a phone, text-messaging system, e-mail client, and Web browser.
10 Part I: Getting Started on BlackBerry Apps Figure 1-1: The BlackBerry Curve Home Screen with the Browser application selected. Figure 1-2: The Browser application in action. Here are a few other reasons why I see the BlackBerry as a great development opportunity: ✓ BlackBerry applications tend to be small. This makes them easy to develop and maintain, and they don’t require a large development team: You need fewer people to debate the pros and cons of different ways to do the same thing.
Chapter 1: Gathering What You Need to Develop BlackBerry Apps actual devices, so you can be sure that if your app works on a simulator, it will work on a real device. ✓ The BlackBerry is widely used in corporate enterprises. From CEOs to administrative assistants and everyone in between, you have a market for business-specific apps that could link everyone in the enterprise. ✓ RIM provides the BlackBerry App World for you to showcase and sell your app.
12 Part I: Getting Started on BlackBerry Apps ✓ Calculator ✓ Alarm Clock Each one of these applications, written by RIM, contains the basic interactions that BlackBerry users expect to see in your application. BlackBerry users will be using the standard applications often, and so you should become familiar with how users get things done with them. Figure 1-3 shows the BlackBerry Email application as I check my mail account. Figure 1-3: The BlackBerry Email app.
Chapter 1: Gathering What You Need to Develop BlackBerry Apps Trackwheel Figure 1-4: The BlackBerry 8700 smartphone provides a trackwheel.
14 Part I: Getting Started on BlackBerry Apps ✓ Trackball: Users can move across the pointer around the two-dimensional BlackBerry screen; to select a highlighted item, the user clicks the trackball itself. Figure 1-5 shows a BlackBerry 8830 with its trackball. Figure 1-5: The BlackBerry 8830 smartphone sports a trackball for input.
Chapter 1: Gathering What You Need to Develop BlackBerry Apps ✓ Trackpad: Users touch the pad lightly to move the selection highlight, and press down to click. You can see the trackpad of the BlackBerry Bold (9700) in Figure 1-6. Trackpad Figure 1-6: RIM’s latest offering: the BlackBerry Bold (9700) and its trackpad. ✓ Touchscreen: Users touch the screen lightly to move the selection highlight, and press down slightly to click the item selected.
16 Part I: Getting Started on BlackBerry Apps trackwheel. If so, you might decide to create two versions of your app: one optimized for use on a BlackBerry Storm, and one for all the other devices. Keep in mind that you might have to adjust your app based on what type of pointing device the user’s BlackBerry supports. Touchscreen Figure 1-7: The BlackBerry Storm with its touchscreen.
Chapter 1: Gathering What You Need to Develop BlackBerry Apps As long as I’m talking about keyboards, there’s one more thing you need to know. BlackBerry smartphones offer two different types of keyboards for users: ✓ SureType: You find this keyboard on the BlackBerry Pearl and Pearl Flip smartphones, as well as a BlackBerry Storm when in portrait mode. Figure 1-8 shows an image of a Pearl with its keyboard.
18 Part I: Getting Started on BlackBerry Apps ✓ Full: You find a regular QWERTY keyboard on every other BlackBerry model, as well as on the BlackBerry Storm when in landscape mode. This is the keyboard I prefer to use because all the keys represent one character and I don’t have to press a key twice. Figure 1-9 shows the BlackBerry Storm in landscape mode with its full QWERTY keyboard on display. Figure 1-9: BlackBerry Storm rotated clockwise to show the full keyboard on a touchscreen.
Chapter 1: Gathering What You Need to Develop BlackBerry Apps ✓ The RAPC compiler: This is the compiler and linker used by the JDE to produce BlackBerry application files. It makes use of the Sun Java compiler (see the following bullet) to compile your BlackBerry Java code, and then packages it into a form that can be installed onto a BlackBerry device. (The acronym RAPC stands for RIM APplication Compiler, and you don’t need to download it — the RAPC compiler comes with the BlackBerry JDE.
20 Part I: Getting Started on BlackBerry Apps Basically, here are the four types of simulator applications you want to use: ✓ JDE device simulators: These come with the JDE, and you launch them with your application already installed. Each JDE comes with its own set of simulated devices, and the newer JDEs have the newest device types simulated. Read more about the device types per JDE version in Appendix A.
Chapter 1: Gathering What You Need to Develop BlackBerry Apps do BlackBerry development. In general, it’s better to have a fast machine with lots of RAM, though you certainly don’t need to buy the most expensive new computer on the market. Figure 1-10: A BlackBerry smartphone simulator running the application WordLocker.
22 Part I: Getting Started on BlackBerry Apps ✓ Compiling the code into an application: This is one of the most powerhungry operations you will be performing again and again. Compiling Java code is very CPU- and memory-intensive, so you want a machine that has good processor speed, and as much memory as you can give it. As mentioned previously, only 32-bit versions of Java and the Windows operating system can be used for BlackBerry development with RIM’s tools.
Chapter 1: Gathering What You Need to Develop BlackBerry Apps These models are available through the major wireless carriers. A particular model may be exclusive to a particular carrier — for instance, the Storm and Storm2 devices are currently Verizon-only, whereas the Bold and Curve devices were originally AT&T-only. AT&T and Verizon strike deals with RIM to be the sole providers of a particular model, but usually the exclusivity is time limited.
24 Part I: Getting Started on BlackBerry Apps Java programming for BlackBerry For BlackBerry development, you should be familiar with Java programming in general, and you should know the basics of Java syntax. BlackBerry Java development is somewhat different from desktop PC Java development. The major difference is BlackBerry Java has a somewhat smaller set of classes that you can use to develop applications. Several of the basic Java packages are available: ✓ java.io.
Chapter 1: Gathering What You Need to Develop BlackBerry Apps ✓ Device interactions: Your applications use the classes in this category’s packages (net.rim.device.*) to perform operations that make use of the various parts of the BlackBerry device, such as using the smartphone’s GPS or communicating with Bluetooth devices. In addition, the classes you use to create every visual user interface object can be found in this category.
26 Part I: Getting Started on BlackBerry Apps The simplest example of a software pattern that you might use is one I employ in a great many of my applications: the Singleton pattern. Only one instance of a singleton class will exist in an application. Most singleton classes have the general appearance shown in Listing 1-1.
Chapter 1: Gathering What You Need to Develop BlackBerry Apps Understanding BlackBerry Application Development Challenges If BlackBerry programming were easy, you wouldn’t need this book. So you need to be prepared for the inevitable difficulties that will appear. Sometimes these challenges are caused by the BlackBerry device or its OS, and you will have to “code around” these types of problems.
28 Part I: Getting Started on BlackBerry Apps ✓ Storm and Storm2 use the touchscreen as their primary input mechanism. This permits your app to make use of users sliding their fingers around the screen, enabling your app to perform some actions more fluidly. ✓ Storm and Storm2 have accelerometers to indicate the orientation of the display. Your app can take advantage of knowing whether the user has switched the device’s orientation from portrait (taller than wide) to landscape (wider than tall).
Chapter 1: Gathering What You Need to Develop BlackBerry Apps Thus, your application can exist in the App World in multiple forms. For example, if you intend for your app to be used only by those users who have accelerometers in their BlackBerry devices, you can restrict your app to an OS 4.7-only zone, and no other device will be able to install it.
30 Part I: Getting Started on BlackBerry Apps As you can see, letting users enter arbitrary text data forces you to implement the appropriate conversion method for turning their entries into a form more suitable for your app to make comparisons and calculations with. However, a basic text-entry field also allows your users to enter text such as Karl’s Birthday just as easily. This text will pretty much crash your application if it tries to add or subtract days, months, or years to or from it.
Chapter 1: Gathering What You Need to Develop BlackBerry Apps you want to develop can be challenging, so I recommend that you review the apps available in the App World in a variety of different categories. Think of this exercise as window shopping. Your imagination will be working in the background while you look at what’s for sale already, and all it takes is one example to trigger something wonderful. Brainstorming, alone or in groups I am a co-founder of a small startup, BlazingApps.
32 Part I: Getting Started on BlackBerry Apps Even if you’re a solo entrepreneur, talking with other developers or even just acquaintances can generate ideas. You can scan the BlackBerry online forums to pick up what issues users are running into and develop ideas based on problems they are encountering and — obviously — want a solution for. Becoming a BlackBerry developer and App World vendor Your first step toward BlackBerry app development is to register with RIM as a BlackBerry developer.