Troubleshooting guide
151
9: Managing applications
Runtime store
BlackBerry® devices use a runtime store as a central location in which applications can share runtime objects. By
default, only applications that Research In Motion (RIM) digitally signs can access data in the runtime store.
Contact RIM for information about how to control access to your data.
The runtime store is not persistent. A BlackBerry device restart clears the data in the runtime store.
Share runtime objects
Delete a module from the BlackBerry device
database.
>Invoke deleteModuleEx(int, Boolean) and provide the following parameters:
• the handle of the module to delete
• a Boolean value to specify whether to delete the module and any data it contains, or to
delete the module only if it does not have data associated with it
int handle = CodeModuleManager.getModuleHandle("test_module");
if( handle != 0 ) {
Boolean success = CodeModuleManager.deleteModule( handle, true );
}
If the module is in use, delete it when the BlackBerry device restarts.
Task Steps
Retrieve the runtime store. >Invoke RuntimeStore.getRuntimeStore().
RuntimeStore store = RuntimeStore.getRuntimeStore();
Add a runtime object. 1. Invoke RuntimeStore.put(long, String) and provide as parameters a unique long ID
and the runtime object to store.
RuntimeStore store = RuntimeStore.getRuntimeStore();
// Create an object and a unique number to identify the object.
String msg = "Some shared text";
long ID = 0x60ac754bc0867248L;
2. Create a try-catch block to manage the IllegalArgumentException that put() throws
if a runtime object with the same ID exists.
try {
store.put( ID, msg );
} catch(IllegalArgumentException e) {
// Handle exception - an object with the same ID exists.
}
Task Steps