Using the Application API, you can retrieve information about the applications installed or currently running on the device, such as application name, icon path, version details, and application ID. You can also receive notifications if applications are updated or removed, or new applications are installed. You can also perform application management tasks, such as launching, closing, or exiting a running application.
The main features of the Application API include:
- Application management
You can manage and retrieve information about the current application with the Application object, which is retrieved using the getCurrentApplication() method of the ApplicationManager interface. You can exit or hide the current application using the Application interface. Additionally, you can retrieve information about a requested application control using the getRequestedAppControl() method of the Application interface. The RequestedApplicationControl interface is used to respond to the requested application control.
- Application information retrieval
You can retrieve information about applications in various ways:
- Retrieve information about installed and running applications with the getAppInfo() and getAppsInfo() methods of the ApplicationManager interface.
- Use the ApplicationInformation interface to retrieve information about installed applications, such as name, icon path, and version.
- Use the ApplicationContext interface to retrieve the application ID and context ID of the running application. The application ID can be used to retrieve application information, or to launch an application. The context ID is a unique identifier given by the platform to a running application.
- Application change notifications
You can receive notifications when there is a change in the list of installed applications.
The addAppInfoEventListener() method of the Application interface registers an event listener, which starts asynchronously once the addAppInfoEventListener() method returns the subscription identifier for the listener. To unsubscribe the listener, use the removeAppInfoEventListener() method with the subscription identifier. You can use the ApplicationInformationEventCallback interface to define listener event handlers for receiving the notifications.
- Application control
You can launch other applications based on their functionality using the launchAppControl() method of the ApplicationManager interface.