BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-11-2008, 11:58 AM   #1 (permalink)
Knows Where the Search Button Is
 
robinShazam's Avatar
 
Join Date: Oct 2008
Location: london, uk
Model: 8120
OS: 4.3.0.67
PIN: N/A
Carrier: Lots
Posts: 15
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting device software version

Please Login to Remove!

How do i get the version of the device software? For example, i am after a string or byte[] that would report "4.2.0" or "4.2.1", etc for the device. I can get the platform version, e.g. 2.6.0.40, but that is not what i am after.

Thanks for your time.
Offline  
Old 11-11-2008, 01:07 PM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Jul 2007
Model: 9000
PIN: N/A
Carrier: Rogers
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

DeviceInfo.getSoftwareVersion()

Last edited by remaerdlacidar : 11-11-2008 at 01:44 PM. Reason: you wanted software version not platform
Offline  
Old 11-11-2008, 01:16 PM   #3 (permalink)
Knows Where the Search Button Is
 
dukejuno's Avatar
 
Join Date: May 2008
Location: STL
Model: 8110
OS: 4.3.0.93
PIN: ALT+EACE
Carrier: ATT
Posts: 20
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wirelessly posted

ALT+EACE
__________________
Cogito Ergo Sum.
Offline  
Old 11-11-2008, 01:55 PM   #4 (permalink)
Knows Where the Search Button Is
 
robinShazam's Avatar
 
Join Date: Oct 2008
Location: london, uk
Model: 8120
OS: 4.3.0.67
PIN: N/A
Carrier: Lots
Posts: 15
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by remaerdlacidar View Post
DeviceInfo.getSoftwareVersion()
Ah thx. This appears to have been added in 4.3 - is there a way to get the software version prior to 4.3? Just curious!
Offline  
Old 11-11-2008, 02:28 PM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Jul 2007
Model: 9000
PIN: N/A
Carrier: Rogers
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

You could try DeviceInfo.getOSVersion()
Offline  
Old 11-21-2008, 12:13 PM   #6 (permalink)
jwb
New Member
 
Join Date: Jun 2005
Model: Many
Carrier: T-Mobile
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by robinShazam View Post
How do i get the version of the device software? For example, i am after a string or byte[] that would report "4.2.0" or "4.2.1", etc for the device. I can get the platform version, e.g. 2.6.0.40, but that is not what i am after.
I do it this way, which works with OS < 4.3 also. I get the version of the ribbon application, and trim off the fourth minor version number, if any. Because the simulator doesn't report a version for the ribbon, I just insert 4.2.1 for the sim.

Code:
String ver = null;

ApplicationManager appMan
= ApplicationManager.getApplicationManager();

ApplicationDescriptor[] appDes
        = appMan.getVisibleApplications();

//check for the version of a standard
//RIM app. I like to use the ribbon
//app but you can check the version
//of any RIM module as they will all
//be the same.

// Also, **** RIM with a chainsaw.
int size = appDes.length;

for (int i = 0; i < size; i++){
        if ((appDes[i].getModuleName()).equals("net_rim_bb_ribbon_app")) {
                ver = appDes[i].getVersion();
                break;
        }
}

if (null == ver || ver.equals(""))
        ver = "4.2.1"; // wild guess

int dots = 0;
int dotindex = 0;
while (-1 != (dotindex = ver.indexOf('.', dotindex))) {
        dots++;
        dotindex++;
}

while (dots > 2) {
        ver = ver.substring(0, ver.lastIndexOf('.'));
        dots--;
}
I know, it seems convoluted, but it's battle-tested.
Offline  
Old 11-21-2008, 12:28 PM   #7 (permalink)
Knows Where the Search Button Is
 
robinShazam's Avatar
 
Join Date: Oct 2008
Location: london, uk
Model: 8120
OS: 4.3.0.67
PIN: N/A
Carrier: Lots
Posts: 15
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Very cool idea, thx for sharing.

I can force our 4.2.0 client to report 4.2.0 (obviously), our 4.3+ client can access getSoftwareVersion so no probs there, and our middle client (4.2.1+ for wi-fi) can guess it is on a 4.2.1 device although it might be on a 4.2.2 but it is no big deal.
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.