Samsung Electronics logo

Retrieving Application Information



Learning how to retrieve information about installed and running applications allows you to manage all the device applications from your application:

  1. To retrieve a list of installed applications, use the getAppsInfo() method of the ApplicationManager interface:

    function onListInstalledApplications(applications) 
    {
       console.log("The number of installed applications is " + applications.length);
    }
    webapis.application.getAppsInfo(onListInstalledApplications);

    The list of applications is returned to the ApplicationInformationArraySuccessCallback() event handler as an array of ApplicationInformation objects.

  2. To retrieve a list of running applications, use the getAppsContext() method of the ApplicationManager interface:

    function onRunningApplicationContexts(contexts) 
    {
       console.log("The number of running applications is " + contexts.length);
    }
    webapis.application.getAppsContext(onRunningApplicationContexts);

    The list of applications is returned to the ApplicationContextArraySuccessCallback() event handler as an array of ApplicationContext objects.

  3. To retrieve basic application information, use the getAppInfo() method of the ApplicationManager interface.

    Provide the application ID of the application whose information you want as a parameter for the method. If no application ID is set, the method retrieves the information for the application calling the method.

    var appinfo = webapis.application.getAppInfo("com.samsungapps.application");
    
    console.log("The application path :" + appinfo.iconPath);
    console.log("The application name :" + appinfo.name); 
    
  4. To retrieve application context information, use the getAppContext() method of the ApplicationManager interface.

    Provide the context ID of the application whose context information you want as a parameter for the method. If no context ID is set, the method retrieves the information for the application calling the method.

       var appContext = webapis.application.getAppContext(); 
       console.log("Application context retrieved for app " + appContext.id);