Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Contributor
Posts: 5
Registered: ‎04-12-2010
My Device: bold 9000
My Carrier: china mobile

how to detect os version programely

HI All:


 I have a project need to run on all various of device platform.The api only have a  DeviceInfo.getDeviceName() method ,it get a string which like "8520,9000",but 8520 or 9000 have two os version 4.6 and 5.0,how can I do to get the os version?


All Replies
New Developer
Posts: 4
Registered: ‎03-26-2009
My Device: Not Specified

Re: how to detect os version programely

Have you tried DeviceInfo.getOSVersion()?

Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: how to detect os version programely

It depends on whether you want the software version or the platform version. What's the difference?


Software Version: the version of the applications (Address book, browser, calendar, etc.)
Platform Version: the version of system software (Java core software, radio code, etc.)


If you want the platform version, this is good for API version 4.0 and up:



String platform = DeviceInfo.getPlatformVersion();


If you want the software version, there are two answers. From 4.3 onward, you can use:




String OSversion = DeviceInfo.getSoftwareVersion();


For pre-4.3, it's a little more complicated:




int[] handles = CodeModuleManager.getModuleHandles();
int size = handles.length;
String OSversion = "unknown";
// check module version for a standard RIM module
// (we'll use the ribbon app, per RIM article DB-00150)
for (int i = size - 1; i >= 0; --i) {
    if (CodeModuleManager.getModuleName(handles[i]).equals(
            "net_rim_bb_ribbon_app")) {
        OSversion = CodeModuleManager.getModuleVersion(handles[i]);




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.