Managing applications
4
Application manager
The BlackBerry® Java® Virtual Machine on the BlackBerry® device includes an application manager that functions as the central
dispatcher of operating system events for other BlackBerry device applications.
The
net.rim.device.api.system.ApplicationManager
class lets BlackBerry device applications interact
with the application manager to perform the following actions:
•
interact with processes, such as retrieving the IDs for foreground BlackBerry device applications
•
post global events to the system
•
run a BlackBerry device application immediately or at a specific time
Retrieve information about a BlackBerry Java Application
1.
Import the following classes:
•
net.rim.device.api.system.ApplicationManager
•
net.rim.device.api.system.ApplicationDescriptor
•
java.lang.String
•
net.rim.device.api.system.
2.
To retrieve information about the processes that are running, invoke
ApplicationManager.getVisibleApplications().
ApplicationManager manager = ApplicationManager.getApplicationManager();
ApplicationDescriptor descriptors[] = manager.getVisibleApplications();
3.
To retrieve descriptions of the objects for the BlackBerry® device applications that are running, invoke
ApplicationDescriptor.getName()
.
String appname1 = descriptors[0].getName();
4.
To retrieve a description of the current BlackBerry device application, invoke
ApplicationDescriptor.current
ApplicationDescriptor()
ApplicationDescriptor descriptor =
ApplicationDescriptor.currentApplicationDescriptor();
Communicate with another BlackBerry Java Applications
1.
Import the
net.rim.device.api.system.ApplicationManager
class.
2.
To post a system-level event to another BlackBerry® device application, invoke one of the
ApplicationManager.postGlobalEvent()
methods.
Development Guide
Managing applications
66