Here is a way to get the software version number of the Blackberry.
Copy and paste the codes in a notepad for easier reading.
import net.rim.device.api.system.*;
import net.rim.device.api.ui.UiApplication;
//Method to retrieve the Blackberry Device Software Version
public static String getSoftwareVersion()
{
String versionTxt = "";
//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")){
versionTxt = appDes[i].getVersion();
}
}
versionTxt = versionTxt.substring(0,3);
return versionTxt;
}
//Method to check if software version is above 4.1
//if it is 4.2 & above, return true
public static boolean isAbove41()
{
String str = getSoftwareVersion();
double versionNum = 0.0;
Dialog.alert("Software: " + str);
versionNum = Double.parseDouble(str);
double theNum = 4.1;
if (versionNum > theNum)
return true;
else
return false;
}
Thursday, 19 March 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment