From a199995ab47b63ce185ebbf2fed1e991e463e962 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 18 Oct 2017 09:21:20 +0900 Subject: [PATCH] Add C# Application Manager API Guide PS3: Reviewed Change-Id: Ib3770d0a8f5693c9a734c0da31516072d41f2e7b Signed-off-by: Hwankyu Jhun --- .../html/dotnet/app_management/app_manager_cs.htm | 174 +++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 org.tizen.guides/html/dotnet/app_management/app_manager_cs.htm diff --git a/org.tizen.guides/html/dotnet/app_management/app_manager_cs.htm b/org.tizen.guides/html/dotnet/app_management/app_manager_cs.htm new file mode 100644 index 0000000..2192d99 --- /dev/null +++ b/org.tizen.guides/html/dotnet/app_management/app_manager_cs.htm @@ -0,0 +1,174 @@ + + + + + + + + + + + + + Application Manager + + + + + +
+ +

Application Manager

+ +

The application manager provides information about installed and running applications. It provides functions for obtaining the application name and absolute path to share files among all applications.

+

The main features of the Tizen.Applications.ApplicationManager class include:

+ +

Iterator methods are used to travel through a list of applications. The GetRunningApplicationsAsync() method of the Tizen.Applications.ApplicationManager class is used for running applications and the GetInstalledApplicationsAsync() method is used for installed applications.

+ + +

Prerequisites

+ +

To enable your application to use the application management functionality:

+
    +
  1. To use the methods and properties of the Tizen.Applications.ApplicationManager, Tizen.Applications.ApplicationRunningContext, and Tizen.Applications.ApplicationInfo classes, include the Tizen.Applications namespace in your application: + +
    +using Tizen.Applications;
    +
    +
  2. +
  3. To use the Resume() method of the Tizen.Applications.ApplicationRunningContext class, the application has to request permission by adding the following privilege to the tizen-manifest.xml file: + +
    +<privileges>
    +   <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
    +</privileges>
    +
    +
+ +

Managing the Application Running Context

+ +

To get the application running context and its details, and to operate on the context:

+ +
    +
  1. Get the context of the currently-running application by creating an instance of the Tizen.Applications.ApplicationRunningContext class, with the ID of the application from which the context is being obtained as a parameter. +

    When an application is not running, it is impossible to get its context.

    +
    +ApplicationRunningContext appRunningContext = new ApplicationRunningContext(Your App ID);
    +
    +
  2. +
  3. Operate on the context: +
      +
    • Get the application ID, package ID, and process ID from the context: +
      +string applicationId = appRunningContext.ApplicationId;
      +string packageId = appRunningContext.PackageId;
      +int processId = appRunningContext.ProcessId;
      +
      +
    • +
    • Check the state of the application: +
      +if (appRunningContext.State == ApplicationRunningContext.AppState.Foreground)
      +    /// UI application is running in the foreground
      +else if (appRunningContext.State == ApplicationRunningContext.AppState.Background)
      +    /// UI application is running in the background
      +else if (appRunningContext.State == ApplicationRunningContext.AppState.Service)
      +    /// Service application is running
      +else if (appRunningContext.State == ApplicationRunningContext.AppState.Terminated)
      +    /// Application is terminated
      +else
      +    /// State is undefined
      +
      +
    • +
    • Resume the running application: +
      +appRunningContext.Resume();
      +
      +
    • +
    +
  4. +
+ + +

Getting Information on Filtered Applications

+ +

To get information on filtered applications:

+ +
    +
  1. Create the filter as an instance of the Tizen.Applications.ApplicationInfoFilter class: +
    +ApplicationInfoFilter appInfoFilter = new ApplicationInfoFilter();
    +
    +
  2. +
  3. Add filter rules: +
    +appInfoFilter.Filter.Add(ApplicationInfoFilter.Keys.Type, "dotnet");
    +
    +
  4. +
  5. Call the GetInstalledApplicationsAsync() method of the Tizen.Applications.ApplicationManager class and retrieve all filtered applications and print their information: +
    +IEnumerable<ApplicationInfo> appInfoList = await ApplicationManager.GetInstalledApplicationsAsync(appinfoFilter);
    +
    +foreach (ApplicationInfo appInfo in appInfoList)
    +{
    +    Log.Debug("Tag", "applicationId: " + appInfo.ApplicationId);
    +    Log.Debug("Tag", "packageId: " + appInfo.PackageId);
    +    Log.Debug("Tag", "label: " + appInfo.Label);
    +    Log.Debug("Tag", "executablePath: " + appInfo.ExecutablePath);
    +    Log.Debug("Tag", "iconPath: " + appInfo.IconPath);
    +    Log.Debug("Tag", "applicationType: " + appInfo.ApplicationType);
    +    Log.Debug("Tag", "isNoDisplay: " + appInfo.IsNoDisplay.ToString());
    +    Log.Debug("Tag", "isOnBoot: " + appInfo.IsOnBoot.ToString());
    +    Log.Debug("Tag", "isPreload: " + appInfo.IsPreload.ToString());
    +    Log.Debug("Tag", "sharedResourcePath: " + appInfo.SharedResourcePath);
    +}
    +
    +
  6. +
+ + + +
+ +Go to top + + + + + + + -- 2.7.4