Series 40 DeveloperTrainingPorting from BlackBerryto Series 40Michael Samarin, Ph.DDirector,Developer TrainingFuturice@Mic...
Porting Considerations» Same development platform Java ME on Series 40 and  BlackBerry (up to OS 7.1).» Same Java dialect ...
General Porting Challenges I» Most BlackBerry “Business” apps are using RIMs  application framework, built on top of Java ...
General Porting Challenges II» BlackBerry platform provides deep integration facilities with  device messaging, telephony ...
Memory Considerations» On Series 40 Memory Limitations:    › Application JAR file size can’t exceed 2 MB.    › Java Heap S...
Portability of App Types 2D Games   Excellent portability, source code-level compatibility. 2D game            development...
Portability of App Types Social Networking   Applications with OAuth authentication are not portable as                   ...
Portability of App Types Telephony and     Generally not portable. The Series 40 platform doesn’t platform          suppor...
Portability of App Types Photography and Generally portable with Advanced Multimedia camera          Supplements APIs (JSR...
Portability of App Types Media playback   Generally portable with Mobile Media API (JSR-135). and streaming    Simple audi...
Most Interesting for porting                QWERTY DevicesBlackBerry Bold 9900    BlackBerry Curve 9350   Nokia Asha 303  ...
Most Interesting for porting                       Full Touch DevicesBlackBerry Torch   BlackBerry Torch                  ...
User Interface Porting Options» A typical BlackBerry application with a standard UI (based on  net.rim.device.api.ui)» On ...
UI Model Differences        BlackBerry                                                   Series 40       UIApplication    ...
Simple Common UI Porting Sample » Illustration of typical steps   for porting UIApplication   based UI.                   ...
UI Differences - BlackBerry: Main Application Class  import net.rim.device.api.ui.UiApplication;  public class App extends...
UI Differences - BlackBerry: Main Screen Classimport    net.rim.device.api.command.Command;                               ...
UI Differences - BlackBerry: Detailed Screen Classimport net.rim.device.api.ui.component.LabelField;import net.rim.device....
UI Differences - BlackBerry: Resulting Screens
UI Differences – Series 40: Complete Application Classimport   javax.microedition.lcdui.Command;                        pu...
UI Differences – Series 40: Resulting Screens
Live Demo SessionBlackBerry SimpleList»   If you are watching these slides on SlideShare, next part is live coding    demo...
Live Demo SessionSeries 40 SimpleList»   If you are watching these slides on SlideShare, next part is live coding    demon...
Live Demo SessionBlackBerry SimpleListMap»   If you are watching these slides on SlideShare, next part is live coding    d...
Live Demo SessionSeries 40 SimpleListMap»   If you are watching these slides on SlideShare, next part is live coding    de...
Live Demo SessionBlackBerry / Series 40 Midlet»   If you are watching these slides on SlideShare, next part is live coding...
Thank you!  @MichaelSamarinhttp://www.futurice.com
Upcoming SlideShare
Loading in...5
×

Porting BlackBerry apps to the Series 40 platform

1,315
-1

Published on

This webinar presentation provides an overview of how to port various types of Java™ applications for BlackBerry OS to the Series 40 platform. Michael Samarin of Futurice walks you through the basic porting tasks involved and shows you how to map BlackBerry APIs to corresponding Series 40 APIs.

3 Comments
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total Views
1,315
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
50
Comments
3
Likes
0
Embeds 0
No embeds

No notes for slide

Porting BlackBerry apps to the Series 40 platform

  1. 1. Series 40 DeveloperTrainingPorting from BlackBerryto Series 40Michael Samarin, Ph.DDirector,Developer TrainingFuturice@MichaelSamarin
  2. 2. Porting Considerations» Same development platform Java ME on Series 40 and BlackBerry (up to OS 7.1).» Same Java dialect makes porting easier.» Midlets based on CLDC 1.1, MIDP 2.0 and common JSRs can be packaged to run without changes on both BlackBerry and Series 40.» Canvas based 2D games without BlackBerry platform services can be just recompiled for Series 40, of course taking screen sizes and graphical assets into consideration.
  3. 3. General Porting Challenges I» Most BlackBerry “Business” apps are using RIMs application framework, built on top of Java ME and utilizing platform integration features.» User interface based on UIApplication frameworks must be re-written.» Developers should recognize the major differences between the platforms: BlackBerry devices are full smartphones with multitasking capabilities, and Series 40 devices are feature phones with much more limited resources and device capabilities.
  4. 4. General Porting Challenges II» BlackBerry platform provides deep integration facilities with device messaging, telephony and PIM.» Series 40 provides only JSR-75, FileConnection and PIM API which gives access only to file system and contacts/calendar entries.
  5. 5. Memory Considerations» On Series 40 Memory Limitations: › Application JAR file size can’t exceed 2 MB. › Java Heap Size is 2 or 4 MB. › Use Nokia Device Matrix for checking: http://www.developer.nokia.com/Devices/Device_specifications/» Brings challenging decisions, especially to visually rich games, with many bundled graphical resources.» Option: post-download of needed resources and caching in RMS.
  6. 6. Portability of App Types 2D Games Excellent portability, source code-level compatibility. 2D game development on BlackBerry and Series 40 uses the same Java ME APIs from the javax.microedition.lcdui.game package. For devices with similar input types (touch, non-touch) porting would be possible by simply recompiling and repackaging. However, the main focus for porting will be the optimization of graphical assets to smaller screen sizes, adaptation of different touch gestures, and adjusting to Series 40 memory requirements. 3D Games Generally portable. BlackBerry 3D gaming uses Java interfaces for OpenGL ES. Series 40 doesn’t support OpenGL ES but it features an excellent implementation of Mobile 3D Graphics (JSR-184 or M3G). This JSR is significantly simpler and optimized for low memory footprint but it is far from being primitive and it is a real 3D rendering engine with a special immediate mode, which is ideologically very similar to OpenGL. Similarly as in 2D gaming, Series 40 memory requirements impose challenges for textures and graphical assets.
  7. 7. Portability of App Types Social Networking Applications with OAuth authentication are not portable as Java apps because the Series 40 platform doesn’t support embeddable web view and the custom Java ME implementation of OAuth appears to be challenging. The Series 40 platform doesn’t support multitasking and background execution, so implementing messaging notifications when the application is not running is not possible. However, if background functionality is not needed and if the social networking app is using custom authentication schemes or private APIs for well-known networks, then it is generally portable. Developers of such apps should consider exploring Nokia Web Apps, where at least the OAuth issue can be resolved. SMS, MMS, and Generally portable. BlackBerry and Series 40 both feature the Bluetooth Wireless Messaging API (JSR-205) and Java APIs for Bluetooth (JSR- Messaging 82). Some parts can be compatible on the source code level with the correct level of abstraction from the UI.
  8. 8. Portability of App Types Telephony and Generally not portable. The Series 40 platform doesn’t platform support integration with telephony and other these messaging types of services for 3rd party developers. Applications services for VoIP, Caller ID, Tethering, platform email, and Social Networking apps’ integrations are not feasible on Series 40. Video, audio, and Generally not portable. The Series 40 platform doesn’t image processing provide APIs for media parsing, recompressing, and image processing. It is also related to memory restrictions (2 or 4 MB Java Heap) imposed on 3rd party applications.
  9. 9. Portability of App Types Photography and Generally portable with Advanced Multimedia camera Supplements APIs (JSR-234) which is also supported on BlackBerry with source code level compatibility. Image filtering and processing full resolution images is not possible due to memory restrictions. News readers, Generally portable. UI redesign and optimization of book readers, graphical assets is required. The Series 40 platform business, finance, doesn’t support embeddable web view and book / comics, magazine reader apps should implement custom text magazines rendering with LCDUI components or Canvas. Comics and magazine readers should take special precautions regarding memory limitations.
  10. 10. Portability of App Types Media playback Generally portable with Mobile Media API (JSR-135). and streaming Simple audio / video playback and streaming is possible and might be compatible on source code level. Redesign is required for background audio streaming apps, which are not supported on Series 40. Maps and Generally portable with Nokia Maps API for Series 40, location which provides also search, geocoding, reverse geocoding, and routing functionality. Series 40 devices are not equipped with GPS, so Cell ID-based location or an external GPS device with Bluetooth connection is needed.
  11. 11. Most Interesting for porting QWERTY DevicesBlackBerry Bold 9900 BlackBerry Curve 9350 Nokia Asha 303 Nokia Asha 302640 x 480 480 x 360 240 x 320 320 x 240QWERTY and Capacitive QWERTY and Capacitive QWERTY QWERTYTouch Screen Touch Screen ROM/RAM ROM/RAM ROM/RAMROM/RAM 8GB/768MB, 512MB/512MB, 32 GB 256MB/128MB, 32 GB 256MB/128MB, 32 GB32 GB Micro SD Micro SD Micro SD Micro SD
  12. 12. Most Interesting for porting Full Touch DevicesBlackBerry Torch BlackBerry Torch Nokia Asha 311 Nokia Asha 305/306 Nokia Asha 308/3099860 9810800 x 480 640 x 480 240 x 400 240 x 400 240 x 400 QWERTY and Capacitive Touch Resistive Touch Capacitive TouchCapacitive Touch Capacitive Touch Screen, Multipoint- Screen, Multipoint- Screen, Multipoint-Screen Screen touch (5 points) touch (2 points) touchROM/RAM ROM/RAM ROM/RAM ROM/RAM ROM/RAM4GB/768MB, 32 GB 8GB/768MB, 32 GB 256MB/128MB, 32 64MB/32MB, 32 GB 128MB/64MB, 32Micro SD Micro SD GB Micro SD Micro SD GB Micro SD
  13. 13. User Interface Porting Options» A typical BlackBerry application with a standard UI (based on net.rim.device.api.ui)» On Series 40, most standard option is LCDUI, gives platform’s Look & Feel, support for device Themes.» Alternative options is LWUIT library, recently optimized for Series 40, full flexible UI with Java Swing-alike architecture.
  14. 14. UI Model Differences BlackBerry Series 40 UIApplication LCDUI New Current Displayable 1 Screen Screen Displayable 2 Current Switch Push Pop Displayable Displayable 3 Stack … Screen 1 Displayable N Screen 2 Screen 3 … Screen N In LCDUI on Series 40 you can switch between screens directly. In addition to LCDUI, Nokia provides Series 40-The screens of a BlackBerry application specific extensions known as the Nokia UI API. These(UiApplication) are managed according APIs enhance MIDP with a functionality related toto the stack model - you can push your touch screen gestures, canvas drawing, text editing,application screens into the stack and and kinetic scrolling.the screen on top of the stack is what isvisible to the user.
  15. 15. Simple Common UI Porting Sample » Illustration of typical steps for porting UIApplication based UI. Main Screen Detailed Screen » Standard UI with master- Item 1 detailed screens. Item 2 Item 2 » List component with Item 3 several items on main … screen. Item N Back » Selected text from previous screen on detailed screen.
  16. 16. UI Differences - BlackBerry: Main Application Class import net.rim.device.api.ui.UiApplication; public class App extends UiApplication { public static void main(String[] args) { App theApp = new App(); theApp.enterEventDispatcher(); } public App() { pushScreen(new AppMainScreen()); } } In the main method we instantiate App class and by using UiApplication method pushScreen() in the constructor of the application class, we create and display main applications screen represented by AppMainScreen class.
  17. 17. UI Differences - BlackBerry: Main Screen Classimport net.rim.device.api.command.Command; Both application screensimport net.rim.device.api.command.CommandHandler;import net.rim.device.api.command.ReadOnlyCommandMetadata; AppMainScreen and SimpleScreen areimport net.rim.device.api.ui.UiApplication; extending MainScreen class which isimport net.rim.device.api.ui.component.table.SimpleList; commonly used screen container thatimport net.rim.device.api.ui.container.MainScreen; inherits all default behavior of thepublic final class AppMainScreen extends MainScreen standard BlackBerry application{ screens. Main screen displays list private SimpleList listField; private SimpleScreen simpleScreen; component based on SimpleList class. Adding list component to the screen public AppMainScreen() { and filling it up with items is super( MainScreen.NO_VERTICAL_SCROLL); setTitle("Simple List Demo"); straightforward operation. One interesting aspect of working with list listField = new SimpleList(getMainManager()); components is tracking selection of listField.add("Helsinki"); listField.add("Tampere"); item. Since there is wide variety of listField.add("London"); BlackBerry devices with touch and listField.add("Paris"); keyboard based input, traditional listField.add("Berlin"); approach is to use both explicit listField.setCommand(new Command(new CommandHandler(){ mechanisms for tracking events. However, the most effective way public void execute(ReadOnlyCommandMetadata metadata, Object context) { which at the same time significantly showSimpleScreen((String)listField.getModel().getRow(listField.getFocusRow())); minimizes code usage is to use } Command class with dedicated })); command handler, like in the example } above. private void showSimpleScreen(String message){ if (simpleScreen == null){ Once it’s been detected, that user simpleScreen = new SimpleScreen(); selected item, method } showSimpleScreen is called with string simpleScreen.setText(message); UiApplication.getUiApplication().pushScreen(simpleScreen); content of the selection. At this point, } there is a need for making check if our} next screen class has been already created, passing string argument and pushing screen to the visible UI stack.
  18. 18. UI Differences - BlackBerry: Detailed Screen Classimport net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.MainScreen;public class SimpleScreen extends MainScreen { LabelField labelField; public SimpleScreen() { super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR); setTitle("Simple Screen"); labelField = new LabelField("Some text", LabelField.FIELD_HCENTER |LabelField.FIELD_VCENTER); add(labelField); } public void setText(String text){ labelField.setText(text); }}Actual code for making detailed screen is simple and features only custom method for providing text content forthe label component.
  19. 19. UI Differences - BlackBerry: Resulting Screens
  20. 20. UI Differences – Series 40: Complete Application Classimport javax.microedition.lcdui.Command; public void startApp() {import javax.microedition.lcdui.CommandListener; display.setCurrent(simpleList);import javax.microedition.lcdui.Display; }import javax.microedition.lcdui.Displayable;import javax.microedition.lcdui.Form; public void pauseApp() {import javax.microedition.lcdui.List; }import javax.microedition.lcdui.StringItem;import javax.microedition.midlet.*; public void destroyApp(boolean unconditional) { }public class SimpleListDemo extends MIDlet implements CommandListener { public void commandAction(Command c, Displayable d) {private Display display; if (c == List.SELECT_COMMAND) {private List simpleList;private Form simpleScreen; stringItem.setText(simpleList.getString(private StringItem stringItem; simpleList.getSelectedIndex()));private static final Command CMD_EXIT = display.setCurrent(simpleScreen); new Command("Exit", Command.EXIT, 1); }private static final Command CMD_BACK = new Command("Back", Command.BACK, 1); if (c == CMD_EXIT) { destroyApp(false);public SimpleListDemo(){ notifyDestroyed(); display = Display.getDisplay(this); } simpleList = new List("Simple List Demo", List.IMPLICIT); if (c == CMD_BACK) { simpleList.append("Helsinki", null); display.setCurrent(simpleList); simpleList.append("Tampere", null); } simpleList.append("London", null); simpleList.append("Paris", null); } simpleList.append("Berlin", null); } simpleList.addCommand(CMD_EXIT); simpleList.setCommandListener(this); simpleScreen = new Form("Simple Screen"); In order to track selection and navigation events in simpleScreen.setCommandListener(this); standard LCDUI components, mechanism of Commands is stringItem = new StringItem("Selected item:", "Some text"); simpleScreen.append(stringItem); used. Midlet implements CommandListener interface and simpleScreen.addCommand(CMD_BACK); selection logic is implemented in commandAction} method. LCDUI doesn’t maintain stack concept of screens, developer can just directly to switch between displayable components
  21. 21. UI Differences – Series 40: Resulting Screens
  22. 22. Live Demo SessionBlackBerry SimpleList» If you are watching these slides on SlideShare, next part is live coding demonstration. Full recording of the live session can be found at Nokia Developer website:» http://www.developer.nokia.com/Resources/Multimedia/Webinars.xhtml
  23. 23. Live Demo SessionSeries 40 SimpleList» If you are watching these slides on SlideShare, next part is live coding demonstration. Full recording of the live session can be found at Nokia Developer website:» http://www.developer.nokia.com/Resources/Multimedia/Webinars.xhtml
  24. 24. Live Demo SessionBlackBerry SimpleListMap» If you are watching these slides on SlideShare, next part is live coding demonstration. Full recording of the live session can be found at Nokia Developer website:» http://www.developer.nokia.com/Resources/Multimedia/Webinars.xhtml
  25. 25. Live Demo SessionSeries 40 SimpleListMap» If you are watching these slides on SlideShare, next part is live coding demonstration. Full recording of the live session can be found at Nokia Developer website:» http://www.developer.nokia.com/Resources/Multimedia/Webinars.xhtml
  26. 26. Live Demo SessionBlackBerry / Series 40 Midlet» If you are watching these slides on SlideShare, next part is live coding demonstration. Full recording of the live session can be found at Nokia Developer website:» http://www.developer.nokia.com/Resources/Multimedia/Webinars.xhtml
  27. 27. Thank you! @MichaelSamarinhttp://www.futurice.com

×