Add C# Application Manager API Guide 61/156261/3
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 18 Oct 2017 00:21:20 +0000 (09:21 +0900)
committerEditor Lionbridge <TizenEditor.SEL@lionbridge.com>
Wed, 18 Oct 2017 09:33:11 +0000 (12:33 +0300)
PS3: Reviewed

Change-Id: Ib3770d0a8f5693c9a734c0da31516072d41f2e7b
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
org.tizen.guides/html/dotnet/app_management/app_manager_cs.htm [new file with mode: 0644]

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 (file)
index 0000000..2192d99
--- /dev/null
@@ -0,0 +1,174 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+       <meta http-equiv="X-UA-Compatible" content="IE=9" />
+       <link rel="stylesheet" type="text/css" href="../../css/styles.css" />
+       <link rel="stylesheet" type="text/css" href="../../css/snippet.css" />
+       <script type="text/javascript" src="../../scripts/snippet.js"></script>
+       <script type="text/javascript" src="../../scripts/jquery.util.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../../scripts/common.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../../scripts/core.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../../scripts/search.js" charset="utf-8"></script>
+  <title>Application Manager</title>
+ </head>
+ <body onload="prettyPrint()" style="overflow: auto;">
+
+ <div id="toc-navigation">
+       <div id="toc_border"><div id="toc">
+               <p class="toc-title">Dependencies</p>
+               <ul class="toc">
+                       <li>Tizen 4.0 and Higher</li>
+               </ul>
+               <p class="toc-title">Content</p>
+               <ul class="toc">
+                       <li><a href="#prerequisites">Prerequisites</a></li>
+                       <li><a href="#manage_context">Managing the Application Running Context</a></li>
+                       <li><a href="#filter">Getting Information on Filtered Applications</a></li>
+               </ul>
+               <p class="toc-title">Related Info</p>
+               <ul class="toc">
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1ApplicationManager.html">Tizen.Applications.ApplicationManager Class</a></li>
+               </ul>
+       </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+
+<h1>Application Manager</h1>
+
+<p>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.</p>
+<p>The main features of the <code>Tizen.Applications.ApplicationManager</code> class include:</p>
+<ul>
+       <li>Managing the application running context
+       <p>For running applications, you can retrieve the application running context and operate on it. You can <a href="#manage_context">manage the application running context</a> with the <code>Tizen.Applications.ApplicationManager</code> class.</p>
+       </li>
+       <li>Getting information on filtered applications
+       <p>For installed (but not necessarily running) applications, you can retrieve information with the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1ApplicationInfo.html">Tizen.Applications.ApplicationInfo</a> class. You can also <a href="#filter">retrieve information through a filter</a> with the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1ApplicationInfoFilter.html">Tizen.Applications.ApplicationInfoFilter</a> class.</p>
+</li>
+</ul>
+<p>Iterator methods are used to travel through a list of applications. The <code>GetRunningApplicationsAsync()</code> method of the <code>Tizen.Applications.ApplicationManager</code> class is used for running applications and the <code>GetInstalledApplicationsAsync()</code> method is used for installed applications.</p>
+
+
+<h2 id="prerequisites">Prerequisites</h2>
+
+<p>To enable your application to use the application management functionality:</p>
+<ol>
+<li>To use the methods and properties of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1ApplicationManager.html">Tizen.Applications.ApplicationManager</a>, <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1ApplicationRunningContext.html">Tizen.Applications.ApplicationRunningContext</a>, and <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1ApplicationInfo.html">Tizen.Applications.ApplicationInfo</a> classes, include the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1Applications.html">Tizen.Applications</a> namespace in your application:
+
+<pre class="prettyprint">
+using Tizen.Applications;
+</pre>
+</li>
+<li>To use the <code>Resume()</code> method of the <code>Tizen.Applications.ApplicationRunningContext</code> class, the application has to request permission by adding the following privilege to the <code>tizen-manifest.xml</code> file:
+
+<pre class="prettyprint">
+&lt;privileges&gt;
+   &lt;privilege&gt;http://tizen.org/privilege/appmanager.launch&lt;/privilege&gt;
+&lt;/privileges&gt;
+</pre>
+</li></ol>
+
+<h2 id="manage_context">Managing the Application Running Context</h2>
+
+<p>To get the application running context and its details, and to operate on the context:</p>
+
+<ol>
+       <li>Get the context of the currently-running application by creating an instance of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1ApplicationRunningContext.html">Tizen.Applications.ApplicationRunningContext</a> class, with the ID of the application from which the context is being obtained as a parameter.
+       <p>When an application is not running, it is impossible to get its context.</p>
+<pre class="prettyprint">
+ApplicationRunningContext appRunningContext = new ApplicationRunningContext(Your App ID);
+</pre>
+       </li>
+       <li>Operate on the context:
+               <ul>
+                       <li>Get the application ID, package ID, and process ID from the context:
+<pre class="prettyprint">
+string applicationId = appRunningContext.ApplicationId;
+string packageId = appRunningContext.PackageId;
+int processId = appRunningContext.ProcessId;
+</pre>
+                       </li>
+                       <li>Check the state of the application:
+<pre class="prettyprint">
+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
+</pre>
+                       </li>
+                       <li>Resume the running application:
+<pre class="prettyprint">
+appRunningContext.Resume();
+</pre>
+                       </li>
+               </ul>
+       </li>
+</ol>
+
+
+<h2 id="filter">Getting Information on Filtered Applications</h2>
+
+<p>To get information on filtered applications:</p>
+
+<ol>
+       <li>Create the filter as an instance of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1ApplicationInfoFilter.html">Tizen.Applications.ApplicationInfoFilter</a> class:
+<pre class="prettyprint">
+ApplicationInfoFilter appInfoFilter = new ApplicationInfoFilter();
+</pre>
+       </li>
+       <li>Add filter rules:
+<pre class="prettyprint">
+appInfoFilter.Filter.Add(ApplicationInfoFilter.Keys.Type, "dotnet");
+</pre>
+       </li>
+       <li>Call the <code>GetInstalledApplicationsAsync()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1ApplicationManager.html">Tizen.Applications.ApplicationManager</a> class and retrieve all filtered applications and print their information:
+<pre class="prettyprint">
+IEnumerable&lt;ApplicationInfo&gt; 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);
+}
+</pre>
+       </li>
+</ol>
+
+<script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>
+<script type="text/javascript" src="../../scripts/showhide.js"></script>
+</div></div></div>
+
+<a class="top sms" href="#"><img src="../../images/btn_top.gif" alt="Go to top" /></a>
+
+<div id="footer">
+<p class="footer">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br/>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
+</div>
+
+<script type="text/javascript">
+var _gaq = _gaq || [];
+_gaq.push(['_setAccount', 'UA-25976949-1']);
+_gaq.push(['_trackPageview']);
+(function() {
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+})();
+</script>
+
+</body>
+</html>