12-12-2009 12:58 AM
Hi, I'm new to Blackberry Development. I've been going through some of the tutorials and other Documentation, and noticed that there are different recommended best practices for different BB devices (e.g. Those with trackball or trackpad vs. touch screen, etc.)
My question is, should I maintain different source code branches for different device types, or is there a way to tell what device it is, and the sprinkle the code with if/then where needed?
Thanks for your help,
12-12-2009 09:23 AM - edited 12-12-2009 01:15 PM
An often asked question as I'm sure you would have guessed. There are many answers, depending on the type of company (for example, if they use automated build processes) and the type of application.
The curve ball is the requirement for different OS's. OS's are forwards but not backwards compatible. For example, if you are compiling for an OS 4.5 device (Curve 8300), you can not include stuff that is specific to the Storm (OS 4.7), because the OS 4.5 won't recognize it. Even if you never run the portion of code with the OS 4.7 API call, if there is 4.7 (for example, touch screen) specific code in your built application, your application will not run on a device that runs an OS before 4.7.
You can use a preprocessor on a single code base to get round this problem, so you require multiple builds depending on your OS requirements. Or have multiple projects with multiple branches.
Second curve ball is the Storm's habit of running in compatibility mode if the application was compiled for an OS before 4.7. So to get a Storm running nicely immeidately you have to compile using 4.7 OS.
I have it easier than most, we focus on the corporate world and generally target a base level (currently 4.2.1), so only offer the functionality for 4.2.1. So we have two builds, one compiled using 4.2.1 for 4.2.1 and above and one fcompiled using 4.7 for that level and above. We try to make the code identical in both so we have just two compiles.
People in consumer space have much more complicated lives, I will let someone else answer for that and provide other alternatives.
In addition, as I mentioned, this or a similar question gets asked frequently. Sorry I don't have a list of useful Threads, but I do recommend you search round. If you find something useful, stick a reference in this Thread. Thanks
Hope this helps.
12-12-2009 12:57 PM
You can follow one simple rule in selecting JDE for development for all devices.
JDE version no. <= min(Supported devices OS version).
This will give you forward compatibility across devices but you won't be able to use advance/special APIs/features of
advanced JDE like touchscreen.
12-12-2009 01:38 PM
you can use DeviceInfo API to detect the properties of device.
12-14-2009 01:14 PM
Thanks for your input. I hope this isn't a dumb question but does Blackberry OS version of 4.5 mean that the jre is also version 4.5, i.e. does the OS version correspond to the jre version?
I'm planning on developing general consumer apps, so what is a good base to start from. From looking at the Blackberry app store, most apps seem to support 4.2 and above, is that reasonable?
12-14-2009 01:37 PM - edited 12-14-2009 01:38 PM
JRE means Java Runtime Environment and is usually associated with the level of Java you have installed on your PC.
Here is a KB article that answers the question I think you were asking.
What Is - Appropriate version of the BlackBerry JDE
Article Number: DB-00537
Re the level to use, in my opinion, the earliest you should consider is 4.2.1. You are right about App World and 4.2, but there are some useful facilities in 4.2.1 which are not in 4.2, the only phone that ever had 4.2 on it was the original Pearl 8100, and there are upgrades for that to 4.2.1 and 4.5.
However there were also some very useful UI improvements made in 4.6, so after 4.2.1, that is the next base level I would consider.
In terms of market share, figures I have seen suggest that at worst, you will lose 3% of the market if you only support 4.2.1 and above, but over 50% of the market if you only support 4.6 and above. However, downloads from App World would suggest that 80% or the active market is 4.6 and above.
The other determinant could be facilities, for example, if you want to integrate the camera into your app, then you need 4.6 and above to do it nicely.
Hope this helps.