Embedded Systems

Porting BlackBerry Z10 Apps to the Q10

By Daniel Rivera, April 23, 2013

With the release of the BlackBerry Q10 right around the corner, BlackBerry 10 application developers should be thinking about adapting their code to support the new devices. This article presents background and tips on development for this new handset.

Webcasts

With the keyboard always being present on the Q10, you can expect users to be pressing keys at any time and expecting a reaction. BlackBerry power users will likely expect that the T and B keys, respectively, bring the viewport to the top and bottom of a scrollable area. Those two shortcuts are part of a list of shortcuts called System shortcuts. Use the Shortcut component directly to handle other keypresses. For example, to respond to the Alt + B combination with an error message, use code such as this:

Now whenever the Alt and B keys are pressed in that page, the error will be generated. Because of subtleties too detailed to explain here, it's important to read the documentation thoroughly before using shortcuts and to understand how shortcut events are propagated.

OLED Screen

The Q10 has an OLED screen, whereas the Z10 has an LCD screen. While the OLED screen has better contrast and clarity, it consumes more power when displaying light colors. Moreover, the brighter pixels burn down faster, thereby causing burn-in.

What can be done prevent this? Cascades has Bright and Dark themes you can control by setting the cascadesTheme node in your app's bar-descriptor.xml file:

<cascadesTheme>dark</cascadesTheme>

If omitted, the platform will automatically select the Cascades dark theme when running on an OLED device, and the light theme for LCD screens. The drawback of letting the system choose is that it can cause undesirable effects if your designers haven't taken it into consideration when producing screens that define static color schemes: Buttons might all of a sudden change color. The static asset selector helps correct this by enabling you to provide assets for each theme, as shown in Figure 3.

I also mentioned previously that the pixel density is different. On the Q10, it's 330 PPI versus. the Z10's 356 PPI, which will make things look slightly bigger because it's less dense. Designers, especially, need to be aware of this.

Finally, if you need to make decisions about UI based on the screen type dynamically, you can always query the DisplayInfo class for information on the kind of display technology the app is currently running on.

Conclusion

It's clear that porting apps from the Z10 to the Q10 requires some careful attention to detail due to the reduced screen size and the presence of a physical keyboard. However, I've found that by following the guidelines suggested here, problems that do arise can be made a lot easier to handle.

Daniel Rivera is a senior developer at Macadamian Technologies and has been working on apps for BlackBerry 10 and using Cascades for more than a year now.

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Video

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!