<p>The Application API provides you with application management and launch features which enable you to:</p>
<ul>
<li>Retrieve information about the applications that are installed or currently running on a device. Information such as application name, icon path, version details, and application ID can be retrieved.</li>
- <li>Receive notifications when applications are updated, removed or installed.</li>
+
<li>Perform application management tasks such as launching, closing, or exiting applications.</li>
</ul>
<li>The <span style="font-family: Courier New,Courier,monospace">getAppContext()</span> and <span style="font-family: Courier New,Courier, monospace">getAppsContext()</span> methods of the <span style="font-family: Courier New,Courier,monospace">ApplicationManager</span> interface can be used to access the <span style="font-family: Courier New,Courier,monospace">ApplicationContext</span> interface (in <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/application.html#ApplicationContext">mobile</a> and <a href="../../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/application.html#ApplicationContext">wearable</a> applications) to retrieve the application ID and context ID of the running application. </li>
</ul></li>
The application ID can be used to retrieve application information, or to launch an application. The context ID is a unique identifier given by the platform to a running application.
- <li>Application change notifications <p>You can <a href="../../../../../org.tizen.tutorials/html/web/tizen/application/application_tutorial_w.htm#receive">receive notifications</a> when there is a change in the list of installed applications.</p> <p>The <span style="font-family: Courier New,Courier,monospace">setPackageInfoEventListener()</span> method of the <span style="font-family: Courier New,Courier,monospace">PackageManager</span> interface in the Package API module registers an event listener which starts asynchronously. To unset the listener, use the <span style="font-family: Courier New,Courier,monospace">unsetPackageInfoEventListener()</span> method. You can use the <span style="font-family: Courier New,Courier,monospace">PackageInformationEventCallback</span> interface (in <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/package.html#PackageInformationEventCallback">mobile</a> and <a href="../../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/package.html#PackageInformationEventCallback">wearable</a> applications) to define listener event handlers for receiving the notifications.</p></li>
<li>Application control <p>You can <a href="../../../../../org.tizen.tutorials/html/web/tizen/application/application_tutorial_w.htm#launch">launch other applications</a> based on their functionality using the <span style="font-family: Courier New,Courier,monospace">launchAppControl()</span> method of the <span style="font-family: Courier New,Courier,monospace">ApplicationManager</span> interface.</p></li>
<li>Handling incoming application control requests
<p>You can <a href="../../../../../org.tizen.tutorials/html/web/tizen/application/application_tutorial_w.htm#handle">handle an incoming application control request</a> using the <span style="font-family: Courier New,Courier,monospace">getRequestedAppControl()</span> method of the <span style="font-family: Courier New,Courier,monospace">Application</span> interface. The <span style="font-family: Courier New,Courier,monospace">RequestedApplicationControl</span> interface (in <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/application.html#RequestedApplicationControl">mobile</a> and <a href="../../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/application.html#RequestedApplicationControl">wearable</a> applications) is used to respond to incoming application control requests.</p></li>
</li>
<li><a href="#manage">Managing Applications</a>
</li>
- <li><a href="#receive">Receiving Notifications on Application List Changes</a>
- </li>
<li><a href="#launch">Launching Applications with the Application Control</a>
</li>
<li><a href="#handle">Handling Application Control Requests</a>
<ul>
<li><a href="#retrieve">Retrieving Application Information</a> <p>Display a list of applications that are currently installed or running on the device, and retrieve application information, such as application name, application ID, and context ID.</p></li>
<li><a href="#manage">Managing Applications</a> <p>Launch, stop, hide, or exit applications.</p></li>
- <li><a href="#receive">Receiving Notifications on Application List Changes</a> <p>Receive notifications when applications are installed, updated, or uninstalled.</p></li>
<li><a href="#launch">Launching Applications with the Application Control</a> <p>Launch applications by a request based on their functionality.</p></li>
<li><a href="#handle">Handling Application Control Requests</a> <p>Handle requests from other applications and reply with a result.</p></li>
</ul>
<pre class="prettyprint">
currApp.exit();
</pre> </li>
- </ol>
-
- <h2 id="receive" name="receive">Receiving Notifications on Application List Changes</h2>
-
- <p>Learning to receive notifications when the list of installed applications changes allows you to manage all the device applications from your application:</p>
- <ol>
- <li> <p>Define the event handlers for different notifications by implementing the <span style="font-family: Courier New,Courier,monospace">ApplicationInformationEventCallback</span> listener interface (in <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/application.html#ApplicationInformationEventCallback">mobile</a> and <a href="../../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/application.html#ApplicationInformationEventCallback">wearable</a> applications):</p>
-
-<pre class="prettyprint">
-var appEventCB =
-{
- /* When a new application is installed */
- oninstalled: function(appInfo)
- {
- console.log("Application " + appInfo.name + " installed");
- }
-
- /* When an application is updated */
- onupdated: function(appInfo)
- {
- console.log("Application " + appInfo.name + " updated");
- }
-
- /* When an application is uninstalled */
- onuninstalled: function(appId)
- {
- console.log("Application " + appId + " uninstalled");
- }
-}
-</pre>
- </li>
- <li> <p>Register the listener to use the defined event handlers:</p>
-<pre class="prettyprint">
-var listenerID = tizen.application.addAppInfoEventListener(appEventCB);
-</pre>
-</li>
- <li> <p>To stop receiving the notifications, use the <span style="font-family: Courier New,Courier,monospace">removeAppInfoEventListener()</span> method of the <span style="font-family: Courier New,Courier,monospace">ApplicationManager</span> interface (in <a href="../../../../../org.tizen.web.apireference/html/device_api/mobile/tizen/application.html#ApplicationManager">mobile</a> and <a href="../../../../../org.tizen.web.apireference/html/device_api/wearable/tizen/application.html#ApplicationManager">wearable</a> applications):</p>
-<pre class="prettyprint">
-tizen.application.removeAppInfoEventListener(listenerID);
-</pre>
- </li>
- </ol>
-
+ </ol>
<h2 id="launch" name="launch">Launching Applications with the Application Control</h2>
<p>Learning to use application controls to launch applications from your application allows you to take advantage of the functionality of other device applications:</p>