Code modules
Retrieve module information
1.
Import the
net.rim.device.api.system.CodeModuleManager
class.
2.
To retrieve a handle for a module, invoke
getModuleHandle()
, and provide the name of the code module as a
parameter.
int handle = CodeModuleManager.getModuleHandle("test_module")
3.
To retrieve specific information about a module, invoke the methods of the
CodeModuleManager
class, and provide
the module handle as a parameter to these methods.
String name = CodeModuleManager.getModuleName( handle );
String vendor = CodeModuleManager.getModuleVendor( handle );
String description = CodeModuleManager.getModuleDescription( handle );
int version = CodeModuleManager.getModuleVersion( handle );
int size = CodeModuleManager.getModuleCodeSize( handle );
int timestamp = CodeModuleManager.getModuleTimestamp( handle );
4.
To retrieve an array of handles for existing modules on a BlackBerry® device, invoke
getModuleHandles()
.
int handles[] = CodeModuleManager.getModuleHandles();
String name = CodeModuleManager.getModuleName( handles[0]);
Access control messages
Displaying a message for an operation that requires user permission
You can use the components of the
net.rim.device.api.applicationcontrol
package to let an
BlackBerry® device application display custom messages to a BlackBerry device user when the BlackBerry device application
attempts an operation that the BlackBerry device user must permit. The BlackBerry device application displays information about
the type of permission that the user must provide. For example, you can use PERMISSION_PHONE for an operation that requires
access to the phone functionality of the BlackBerry device.
You can use the
applicationcontrol
package to include a custom message with the default message that a BlackBerry
device application displays in response to an application control.
Development Guide
Code modules
68