Add guide document for PackageManager of dotnet 64/152564/3
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 26 Sep 2017 10:16:06 +0000 (19:16 +0900)
committerEditor Lionbridge <TizenEditor.SEL@lionbridge.com>
Tue, 26 Sep 2017 12:52:48 +0000 (15:52 +0300)
PS3: Reviewed

Change-Id: If82339af3ae173f66fd27ce2c8802cea4b81d099
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
org.tizen.guides/html/dotnet/package_manager_cs.htm [new file with mode: 0644]

diff --git a/org.tizen.guides/html/dotnet/package_manager_cs.htm b/org.tizen.guides/html/dotnet/package_manager_cs.htm
new file mode 100644 (file)
index 0000000..87bb7ce
--- /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>Package 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="#retrieve">Retrieving All Package Information</a></li>
+                       <li><a href="#info">Retrieving Specific Package Information</a></li>
+                       <li><a href="#listen">Monitoring Package Events</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_1PackageManager.html">Tizen.Applications.PackageManager Class</a></li>
+               </ul>
+       </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+<h1>Package Manager</h1>
+
+<p>The package manager is used to retrieve detailed information on the installed packages on the device. This information includes the package name, label, path to the icon image, version, type, and installed storage.</p>
+
+<p>The main features of the <code>Tizen.Applications.PackageManager</code> class include:</p>
+<ul>
+
+<li>Retrieving information for all installed packages
+<p>Use the <code>GetPackages()</code> method of the <code>Tizen.Applications.PackageManager</code> class to <a href="#retrieve">retrieve the package information for all installed packages</a>. The method returns an <code>IEnumerable&lt;Package&gt;</code> object with the package information.</p></li>
+<li>Retrieving individual package information
+<p>To <a href="#info">retrieve package information</a>, get the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1Package.html">Tizen.Applications.Package</a> object using the <code>GetPackage()</code> method of the <code>Tizen.Applications.PackageManager</code> class.</p></li>
+<li>Monitoring changes
+<p>You can <a href="#listen">monitor package events</a>, such as installation, uninstallation, and updates.</p></li>
+</ul>
+
+<h2 id="prerequisites">Prerequisites</h2>
+
+<p>To enable your application to use the package manager functionality:</p>
+<ol>
+<li>
+<p>To use the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1PackageManager.html">Tizen.Applications.PackageManager</a> class, the application has to request permission by adding the following privilege to the <code>tizen-manifest.xml</code> file:</p>
+<pre class="prettyprint">
+&lt;privileges&gt;
+   &lt;privilege&gt;http://tizen.org/privilege/packagemanager.info&lt;/privilege&gt;
+&lt;/privileges&gt;
+</pre>
+</li>
+<li><p>To use the methods and properties of the <code>Tizen.Applications.PackageManager</code> class, include the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1Applications.html">Tizen.Applications</a> namespace in your application:</p>
+<pre class="prettyprint">
+using Tizen.Applications;
+</pre></li>
+</ol>
+
+<h2 id="retrieve">Retrieving All Package Information</h2>
+
+<p>To retrieve all package information for installed packages:</p>
+
+<ol>
+<li>Retrieve all package information with the <code>GetPackages()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1PackageManager.html">Tizen.Applications.PackageManager</a> class:
+
+<pre class="prettyprint">
+IEnumerable&lt;Package&gt; packageList = PackageManager.GetPackages();
+</pre></li>
+<li>Iterate through the returned list to access information about each <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1Package.html">Tizen.Applications.Package</a> object:
+<pre class="prettyprint">
+foreach (Package package in packageList)
+{
+    Log.Debug(LogTag, "pkgid: " + package.Id);
+    Log.Debug(LogTag, "label: " + package.Label);
+    Log.Debug(LogTag, "icon: " + package.IconPath);
+    Log.Debug(LogTag, "version: " + package.Version);
+    Log.Debug(LogTag, "type: " + package.PackageType);
+    Log.Debug(LogTag, "storage: " + package.InstalledStorageType);
+    Log.Debug(LogTag, "system: " + package.IsSystemPackage);
+    Log.Debug(LogTag, "removable: " + package.IsRemovable);
+    Log.Debug(LogTag, "preload: " + package.IsPreloaded);
+}
+</pre></li></ol>
+
+ <h2 id="info">Retrieving Specific Package Information</h2>
+
+<p>To get specific package information:</p>
+<ol>
+<li>Retrieve information for a specific package with the <code>GetPackage()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1PackageManager.html">Tizen.Applications.PackageManager</a> class:
+
+<pre class="prettyprint">
+Package package = PackageManager.GetPackage("org.tizen.helloworld");
+</pre>
+</li>
+<li>Use the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1Package.html">Tizen.Applications.Package</a> object returned by the <code>GetPackage()</code> method to access various package details:
+
+<pre class="prettyprint">
+/// Use package information
+Log.Debug(LogTag, "pkgid: " + package.Id);
+Log.Debug(LogTag, "label: " + package.Label);
+Log.Debug(LogTag, "icon: " + package.IconPath);
+Log.Debug(LogTag, "version: " + package.Version);
+Log.Debug(LogTag, "type: " + package.PackageType);
+Log.Debug(LogTag, "storage: " + package.InstalledStorageType);
+Log.Debug(LogTag, "system: " + package.IsSystemPackage);
+Log.Debug(LogTag, "removable: " + package.IsRemovable);
+Log.Debug(LogTag, "preload: " + package.IsPreloaded);
+</pre>
+</li>
+</ol>
+
+ <h2 id="listen">Monitoring Package Events</h2>
+
+<p>To detect package-related events, such as installation, uninstallation, and updates:</p>
+<ol>
+<li>Register event handlers for various events of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1PackageManager.html">Tizen.Applications.PackageManager</a> class.
+<p>The following example registers event handlers for package installation, uninstallation, and update events:</p>
+<pre class="prettyprint">
+PackageManager.InstallProgressChanged += new System.EventHandler&lt;PackageManagerEventArgs&gt;(InstallEventHandler);
+PackageManager.UninstallProgressChanged += new System.EventHandler&lt;PackageManagerEventArgs&gt;(UninstallEventHandler);
+PackageManager.UpdateProgressChanged += new System.EventHandler&lt;PackageManagerEventArgs&gt;(UpdateEventHandler);
+</pre>
+</li>
+<li>Define the event handlers. When the related event occurs, the event handler is triggered and you can get the event details from the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Applications_1_1PackageManagerEventArgs.html">Tizen.Applications.PackageManagerEventArgs</a> instance.
+<p>The following example implements the installation event handler:</p>
+<pre class="prettyprint">
+void InstallEventHandler(object sender, PackageManagerEventArgs args)
+{
+    Log.Debug(LogTag, "pkgId: " + args.PackageId);
+    Log.Debug(LogTag, "pkgType:" + args.PackageType);
+    Log.Debug(LogTag, "progress:" + args.Progress);
+    Log.Debug(LogTag, "eventState:" + args.State);
+}
+</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>