Blackberry - platform version and software version
I am using a BlackBerry model 8707 and am trying to use DeviceInfo.getPlatformVersion() and DeviceInfo.getSoftwareVersion(). However, the result is not shown on the 8707 simulator but it works perfectly fine on the 9550 simulator.
How do I make it work with the 8707?
public RetrieveData() {
display = Display.getDisplay(this);
String imei = IDENInfo.imeiToString(IDENInfo.getIMEI());
info01 = new TextField("IMEI:", imei, 30, TextField.ANY);
String开发者_JAVA技巧 imsi = new String();
try {
imsi=GPRSInfo.imeiToString(SIMCardInfo.getIMSI(), false);
} catch (SIMCardException ioe) {}
info02 = new TextField("IMSI:", imsi, 30, TextField.ANY);
String majorOS = DeviceInfo.getPlatformVersion();
info03 = new TextField("majorOS:", majorOS, 30, TextField.ANY);
String content = DeviceInfo.getSoftwareVersion();
info04 = new TextField("Software version", content, 30, TextField.ANY);
}
you can use this method to get the version of almost every black berry device:
public static String getJDEVersion() {
//USING THE APPLICATION MANAGER
//(RUNNING APPS)
//get the ApplicationManager
ApplicationManager appMan = ApplicationManager.getApplicationManager();
//grab the running applications
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.
int size = appDes.length;
for (int i = size-1; i>=0; --i){
if ((appDes[i].getModuleName()).equals("net_rim_bb_ribbon_app") ){
return appDes[i].getVersion();
}
}
return null;
}
What OS version is the 8707 simulator running? And what OS level are you compiling to? From the DeviceInfo javadocs, you can see that the DeviceInfo.getPlatformVersion()
method is available in OS 4.0.0 and higher, whereas the DeviceInfo.getSoftwareVersion()
method is available in OS 4.3.0 and higher. So if you're compiling with JDE 4.3 but trying to run it on a device simulator with an OS version lower than 4.3, you're going to run into problems.
EDIT: a workaround for pre-4.3 devices is to use the following code:
int mh = CodeModuleManager.getModuleHandle("net_rim_bb_phone_api");
String version = CodeModuleManager.getModuleVersion(mh);
精彩评论