To get the module names in blackberry

2020-08-08 11:24发布

问题:

I want to get the application module name I have installed in Blackberry, just like "Messages","Contacts" etc. How can i get this module's names which are running now?

回答1:

Check following code snippet:

//get the ApplicationManager
ApplicationManager appMan = ApplicationManager.getApplicationManager();

//grab the running applications
ApplicationDescriptor[] appDes = appMan.getVisibleApplications();

int size = appDes.length;
for (int i = size - 1; i >= 0; --i) {
    String moduleName = appDes[i].getModuleName();
    String name = appDes[i].getName();
    // other codes....
}


Also read the API documentation for following classes:

  • ApplicationManager

  • ApplicationDescriptor

  • CodeModuleGroupManager

  • CodeModuleGroup



回答2:

You can get the current applications module name or handle by using this line:

String name = ApplicationDescriptor.currentApplicationDescriptor().getModuleName();

This returns the string of the module handle of this application. Or by using

int handle = ApplicationDescriptor.currentApplicationDescriptor().getModuleHandle();


回答3:

If you want to get the Application Version (programatically) you can use:

net.rim.device.api.system.DeviceInfo.getSoftwareVersion()



标签: blackberry