Accessing and launching installed applications

The AppManager Service API allows widgets to access and launch applications on a device. You can use the AppManager Service to create widgets that:

  • Retrieve a list of user-installed applications

  • Retrieve a list of all applications on the mobile device, regardless of whether they were preinstalled or installed by the user

  • Launch an application based on an application UID

  • Launch an application based on a given document or MIME type

The service allows widgets to launch applications as chained (embedded) or stand-alone. This provides the following functionality:

  • Embedded applications are launched within another application and share the same process. All UI features (such as the options list and icons displayed in the header) belong to the launching application, not the embedded application. For example, embedding the browser to display HTML within an SMS message is a typical use case. In this case, all UI features belong to the messaging application.

  • Stand-alone applications are independent of other applications - they do not share the same process. Applications can launch other applications as stand-alone, in which case they run as peer applications. For example, launching the browser when a user selects a URL within an SMS message is a typical use case. In this case, the user can swap between the browser and messaging applications.

Accessing the API and supported methods

To create a service object for the AppManager Service API, use Service.AppManager to identify the service provider and IAppManager to identify the supported interface:

var so = device.getServiceObject("Service.AppManager", "IAppManager");

The IAppManager interface provides the following methods:

  • GetList()

    Use the GetList() method to get a list of user-installed applications or all applications on the mobile device.

  • LaunchApp()

    Use the LaunchApp() method to launch an application based on the application UID. Use GetList() to retrieve the correct UID.

  • LaunchDoc()

    Use the LaunchDoc() method to launch an application based on a given document or a MIME type.

  • Cancel()

    Use the Cancel() method to cancel an ongoing asynchronous call. This method is valid for any asynchronous call made through the AppManager Service API.