问题
I am new to blackberry development, Is it possible to get package name of the application which is installed in device. I din't get any reference for this.
int[] handle = codeModuleManager.getModuleHandles();
for(int i=0; i<handle.length; i++){
ApplicationDescriptor[] app_descriptors = CodeModuleManager.getApplicationDescriptors(handle[i]);
if(app_descriptors != null){
System.out.println("app_descriptors length "+ app_descriptors.length);
for(int j=0; j< app_descriptors.length; j++){
System.out.println("Iterating the arraylist :: "+ app_descriptors[j].toString());
}
}
}
回答1:
Try this - This will get all the installed modules.
int[] v=net.rim.device.api.system.CodeModuleManager.getModuleHandles();
For getting the ApplicationDescriptors associated with the module, use the following code -
net.rim.device.api.system.CodeModuleManager.getApplicationDescriptors(int moduleHandle)
Edit : -
int[] handle = CodeModuleManager.getModuleHandles();
for(int i=0; i<handle.length; i++){
ApplicationDescriptor[] app_descriptors = CodeModuleManager.getApplicationDescriptors(handle[i]);
if(app_descriptors != null){
System.out.println("app_descriptors length "+ app_descriptors.length);
for(int j=0; j< app_descriptors.length; j++){
String moduleName = app_descriptors[i].getModuleName();
String name = app_descriptors[i].getName();
}
}
}
来源:https://stackoverflow.com/questions/11843270/how-to-get-package-name-using-blackberry