04-20-2010 10:23 PM
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?
Thanks
04-20-2010 11:08 PM
Have you tried DeviceInfo.getOSVersion()?
04-20-2010 11:39 PM
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]).equal s(
"net_rim_bb_ribbon_app")) {
OSversion = CodeModuleManager.getModuleVersion(handles[i]);
break;
}
}