</li>
<li>2.17. <a href="#EventCallback">EventCallback</a>
</li>
-<li>2.18. <a href="#EventInfo">EventInfo</a>
+<li>2.18. <a href="#StatusEventCallback">StatusEventCallback</a>
+</li>
+<li>2.19. <a href="#EventInfo">EventInfo</a>
</li>
</ul>
</li>
<div>DOMString <a href="#ApplicationManager::getAppSharedURI">getAppSharedURI</a> (optional <a href="#ApplicationId">ApplicationId</a>? id)</div>
<div>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] <a href="#ApplicationManager::getAppMetaData">getAppMetaData</a> (optional <a href="#ApplicationId">ApplicationId</a>? id)</div>
-<div class="deprecated">long <a href="#ApplicationManager::addAppInfoEventListener">addAppInfoEventListener</a> (<a href="#ApplicationInformationEventCallback">ApplicationInformationEventCallback</a> eventCallback)</div>
-<div class="deprecated">void <a href="#ApplicationManager::removeAppInfoEventListener">removeAppInfoEventListener</a> (long watchId)</div>
+<div>long <a href="#ApplicationManager::addAppStatusChangeListener">addAppStatusChangeListener</a> (<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId)</div>
+<div>void <a href="#ApplicationManager::removeAppStatusChangeListener">removeAppStatusChangeListener</a> (long watchId)</div>
</td>
</tr>
<tr>
<td><div>void <a href="#EventCallback::onevent">onevent</a> (<a href="#EventInfo">EventInfo</a> event, <a href="#EventData">EventData</a> data)</div></td>
</tr>
<tr>
+<td><a href="#StatusEventCallback">StatusEventCallback</a></td>
+<td><div>void <a href="#StatusEventCallback::onchange">onchange</a> (<a href="#ApplicationId">ApplicationId</a> appId, boolean isActive)</div></td>
+</tr>
+<tr>
<td><a href="#EventInfo">EventInfo</a></td>
<td></td>
</tr>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] getAppMetaData(optional <a href="#ApplicationId">ApplicationId</a>? id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- long addAppInfoEventListener(<a href="#ApplicationInformationEventCallback">ApplicationInformationEventCallback</a> eventCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- void removeAppInfoEventListener(long watchId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void removeAppStatusChangeListener(long watchId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
};</pre>
<p><span class="version">
Since: </span>
Since: </span>
2.0
</p>
+<p><span class="remark"> Remark : </span>
+ This method is not supported by Web Widget.
+ </p>
<div class="returntype">
<p><span class="return">Return value:</span></p>
Application The data structure that defines the current application.
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onKillSuccess()
{
- console.log("Application terminated successfully");
+ console.log("Application terminated successfully");
}
function onRunningAppsContext(contexts)
{
- /* Let's assume that the application "targetApp0.main" has been installed */
- var targetId = "targetApp0.main";
-
- for (var i = 0; i < contexts.length; i++)
- {
- if (contexts[i].appId == targetId)
- {
- tizen.application.kill(contexts[i].id, onKillSuccess);
- }
- }
+ /* Let's assume that the application "targetApp0.main" has been installed */
+ var targetId = "targetApp0.main";
+
+ for (var i = 0; i < contexts.length; i++)
+ {
+ if (contexts[i].appId == targetId)
+ {
+ tizen.application.kill(contexts[i].id, onKillSuccess);
+ }
+ }
}
tizen.application.getAppsContext(onRunningAppsContext);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess()
{
- console.log("The application has launched successfully");
+ console.log("The application has launched successfully");
}
/* Let's assume that application "targetApp0.main" has been installed */
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
var appControlReplyCallback =
{
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log("Selected image is " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log("The launch application control failed");
+ }
}
tizen.application.launchAppControl(appControl, null,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
</pre>
</div>
</dd>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
function successCB(appInfos, appControl)
{
- /* appControl is same object with the value passed as first parameter to findAppControl() */
- var appControlReplyCallback =
- {
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; /* Select first app's id */
-
- tizen.application.launchAppControl(appControl, appId,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log("Selected image is " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log("The launch application control failed");
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed"); },
+ function(e) {console.log("launch application control failed. reason: " + e.message); },
+ appControlReplyCallback);
}
tizen.application.findAppControl(appControl, successCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onRunningAppsContext(contexts)
{
- for (var i = 0; i < contexts.length; i++)
- console.log("ID: " + contexts[i].id);
+ for (var i = 0; i < contexts.length; i++)
+ console.log("ID: " + contexts[i].id);
}
tizen.application.getAppsContext(onRunningAppsContext);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledApps(applications)
{
- for (var i = 0; i < applications.length; i++)
- console.log("ID: " + applications[i].id);
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
for (var i = 0; i < appCerts.length; i++)
{
- console.log("#" + i + " type:" + appCerts[i].type);
- console.log("#" + i + " value:" + appCerts[i].value);
+ console.log("#" + i + " type:" + appCerts[i].type);
+ console.log("#" + i + " value:" + appCerts[i].value);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is installed");
+ },
+ onupdated: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is updated");
+ },
+ onuninstalled: function(appid)
+ {
+ console.log("The application " + appid + " is uninstalled");
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is installed");
+ },
+ onupdated: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is updated");
+ },
+ onuninstalled: function(appid)
+ {
+ console.log("The application " + appid + " is uninstalled");
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
tizen.application.removeAppInfoEventListener(watchId);
</pre>
</div>
</dd>
+<dt class="method" id="ApplicationManager::addAppStatusChangeListener">
+<a class="backward-compatibility-anchor" name="::Application::ApplicationManager::addAppStatusChangeListener"></a><code><b><span class="methodName">addAppStatusChangeListener</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Adds a listener for receiving any notification for status changes of the installed applications on a device.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">eventCallback</span>:
+ The method to call when status of the installed applications is changed.
+ </li>
+ <li class="param">
+<span class="name">appId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The id of the application which status changes should be monitored. If the application id is ommitted or it is equal to <em>null</em>, all applications status changes will be monitored.
+ </li>
+ </ul>
+</div>
+<div class="returntype">
+<p><span class="return">Return value:</span></p>
+ long Listener id that can be used to remove the listener later.
+ </div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul>
+<li class="list"><p>
+ with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
+ </p></li>
+<li class="list"><p>
+ with error type InvalidValuesError, if the application id parameter is an empty string.
+ </p></li>
+<li class="list"><p>
+ with error type AbortError, if it fails to add a listener.
+ </p></li>
+</ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function appStatusEventCallback(appId, isActive)
+{
+ console.log("The application " + appId + " has been " + (isActive ? "activated" : "deactivated"));
+}
+
+var watchId = tizen.application.addAppStatusChangeListener(appStatusEventCallback);
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> The application testAppId has been activated
+ </pre>
+</div>
+</dd>
+<dt class="method" id="ApplicationManager::removeAppStatusChangeListener">
+<a class="backward-compatibility-anchor" name="::Application::ApplicationManager::removeAppStatusChangeListener"></a><code><b><span class="methodName">removeAppStatusChangeListener</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Removes the listener to stop receiving notifications for status changes of the installed applications on a device.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void removeAppStatusChangeListener(long watchId);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">watchId</span>:
+ An ID that identifies the listener.
+ </li>
+ </ul>
+</div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul><li class="list"><p>
+ with error type AbortError, if it fails to remove listener.
+ </p></li></ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function appStatusEventCallback(appId, isActive)
+{
+ console.log("The application " + appId + " has been " + (isActive ? "activated" : "deactivated"));
+}
+
+try
+{
+ var watchId = tizen.application.addAppStatusChangeListener(appStatusEventCallback);
+ tizen.application.removeAppStatusChangeListener(watchId);
+ console.log("Listener with id " + watchId + " has been removed");
+}
+catch (err)
+{
+ console.log("Exception: " + err.name);
+}
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> Listener with id 1 has been removed
+ </pre>
+</div>
+</dd>
</dl>
</div>
</div>
Since: </span>
2.0
</p>
+<p><span class="remark"> Remark : </span>
+ This method is not supported by Web Widget.
+ </p>
<div class="exceptionlist">
<p><span class="except">Exceptions:</span></p>
<ul class="exception"><li>WebAPIException<ul><li class="list"><p>
Since: </span>
2.0
</p>
+<p><span class="remark"> Remark : </span>
+ This method is not supported by Web Widget.
+ </p>
<div class="exceptionlist">
<p><span class="except">Exceptions:</span></p>
<ul class="exception"><li>WebAPIException<ul><li class="list"><p>
appropriately when it is launched.
</p>
</div>
+<p><span class="remark"> Remark : </span>
+ This method is not supported by Web Widget.
+ </p>
<div class="returntype">
<p><span class="return">Return value:</span></p>
RequestedApplicationControl The details of a requested application control
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
}
</pre>
</div>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- if (appId)
- {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
- {
- console.log("Data: " + JSON.stringify(data));
- /* Do something */
- });
- }
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ });
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
- var watchId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- if (appId)
- {
- watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
- {
- if (watchId)
- {
- app.removeEventListener(watchId);
- watchId = null;
- }
- });
- }
+ var appId = null;
+ var watchId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ if (watchId)
+ {
+ app.removeEventListener(watchId);
+ watchId = null;
+ }
+ });
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var myCustomData =
{
- foo: 'bar'
+ foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var myTrustedCustomData =
{
- foo: 'bar'
+ foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
- null, "image/jpeg", null,
- [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
+ null, "image/jpeg", null,
+ [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
</pre>
</div>
<div class="constructors">
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
-
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
- {
- var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
- reqAppControl.replyResult([data]);
- }
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
+ reqAppControl.replyResult([data]);
+ }
}
</pre>
</div>
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
- {
- reqAppControl.replyFailure();
- }
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ reqAppControl.replyFailure();
+ }
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledApps(applications)
{
- for (var i = 0; i < applications.length; i++)
- console.log("ID: " + applications[i].id);
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
/* FindAppControlSuccessCallback instance */
function successCB(appInfos, appControl)
{
- /* appControl is same object with the value passed as first parameter to findAppControl() */
- var appControlReplyCallback =
- {
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; /* Select first app's id */
-
- tizen.application.launchAppControl(appControl, appId,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log("Selected image is " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log("The launch application control failed");
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed"); },
+ function(e) {console.log("launch application control failed. reason: " + e.message); },
+ appControlReplyCallback);
}
tizen.application.findAppControl(appControl, successCB);
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
/* ApplicationControlDataArrayReplyCallback instance */
var appControlReplyCallback =
{
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log("Selected image is " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log("The launch application control failed");
+ }
}
tizen.application.launchAppControl(appControl, null,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
</pre>
</div>
<div class="methods">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is installed");
+ },
+ onupdated: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is updated");
+ },
+ onuninstalled: function(appid)
+ {
+ console.log("The application " + appid + " is uninstalled");
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
</pre>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- var eventCB = function(event, data)
- {
- console.log("Data: " + JSON.stringify(data));
- /* Do something */
- };
-
- if (appId)
- {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
- }
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ var eventCB = function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ };
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
</dl>
</div>
</div>
+<div class="interface" id="StatusEventCallback">
+<a class="backward-compatibility-anchor" name="::Application::StatusEventCallback"></a><h3>2.18. StatusEventCallback</h3>
+<div class="brief">
+ The StatusEventCallback interface specifies a callback for getting notified when status of the installed application has been changed.
+ </div>
+<pre class="webidl prettyprint"> [Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback {
+ void onchange(<a href="#ApplicationId">ApplicationId</a> appId, boolean isActive);
+ };</pre>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="methods">
+<h4>Methods</h4>
+<dl>
+<dt class="method" id="StatusEventCallback::onchange">
+<a class="backward-compatibility-anchor" name="::Application::StatusEventCallback::onchange"></a><code><b><span class="methodName">onchange</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Called when the status event occurs.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void onchange(<a href="#ApplicationId">ApplicationId</a> appId, boolean isActive);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="description">
+ <p>
+Example of using can be find at <a href="application.html#ApplicationManager::addAppStatusChangeListener">addAppStatusChangeListener</a> code example.
+ </p>
+ </div>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">appId</span>:
+ Id of the application that status has been changed.
+ </li>
+ <li class="param">
+<span class="name">isActive</span>:
+ The new status of the application.
+ </li>
+ </ul>
+</div>
+</dd>
+</dl>
+</div>
+</div>
<div class="dictionary" id="EventInfo">
-<a class="backward-compatibility-anchor" name="::Application::EventInfo"></a><h3>2.18. EventInfo</h3>
+<a class="backward-compatibility-anchor" name="::Application::EventInfo"></a><h3>2.19. EventInfo</h3>
<div class="brief">
The EventInfo dictionary identifies an event with information such as event name. If it is an user event, the broadasting application's identifier is also specified.
</div>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] getAppMetaData(optional <a href="#ApplicationId">ApplicationId</a>? id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- long addAppInfoEventListener(<a href="#ApplicationInformationEventCallback">ApplicationInformationEventCallback</a> eventCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- void removeAppInfoEventListener(long watchId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void removeAppStatusChangeListener(long watchId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
};
[NoInterfaceObject] interface Application {
void onevent(<a href="#EventInfo">EventInfo</a> event, <a href="#EventData">EventData</a> data);
};
+ [Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback {
+ void onchange(<a href="#ApplicationId">ApplicationId</a> appId, boolean isActive);
+ };
+
dictionary EventInfo {
<a href="#ApplicationId">ApplicationId</a> appId;
</li>
<li>2.17. <a href="#EventCallback">EventCallback</a>
</li>
-<li>2.18. <a href="#EventInfo">EventInfo</a>
+<li>2.18. <a href="#StatusEventCallback">StatusEventCallback</a>
+</li>
+<li>2.19. <a href="#EventInfo">EventInfo</a>
</li>
</ul>
</li>
<div>DOMString <a href="#ApplicationManager::getAppSharedURI">getAppSharedURI</a> (optional <a href="#ApplicationId">ApplicationId</a>? id)</div>
<div>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] <a href="#ApplicationManager::getAppMetaData">getAppMetaData</a> (optional <a href="#ApplicationId">ApplicationId</a>? id)</div>
-<div class="deprecated">long <a href="#ApplicationManager::addAppInfoEventListener">addAppInfoEventListener</a> (<a href="#ApplicationInformationEventCallback">ApplicationInformationEventCallback</a> eventCallback)</div>
-<div class="deprecated">void <a href="#ApplicationManager::removeAppInfoEventListener">removeAppInfoEventListener</a> (long watchId)</div>
+<div>long <a href="#ApplicationManager::addAppStatusChangeListener">addAppStatusChangeListener</a> (<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId)</div>
+<div>void <a href="#ApplicationManager::removeAppStatusChangeListener">removeAppStatusChangeListener</a> (long watchId)</div>
</td>
</tr>
<tr>
<td><div>void <a href="#EventCallback::onevent">onevent</a> (<a href="#EventInfo">EventInfo</a> event, <a href="#EventData">EventData</a> data)</div></td>
</tr>
<tr>
+<td><a href="#StatusEventCallback">StatusEventCallback</a></td>
+<td><div>void <a href="#StatusEventCallback::onchange">onchange</a> (<a href="#ApplicationId">ApplicationId</a> appId, boolean isActive)</div></td>
+</tr>
+<tr>
<td><a href="#EventInfo">EventInfo</a></td>
<td></td>
</tr>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] getAppMetaData(optional <a href="#ApplicationId">ApplicationId</a>? id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- long addAppInfoEventListener(<a href="#ApplicationInformationEventCallback">ApplicationInformationEventCallback</a> eventCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- void removeAppInfoEventListener(long watchId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void removeAppStatusChangeListener(long watchId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
};</pre>
<p><span class="version">
Since: </span>
Since: </span>
2.0
</p>
+<p><span class="remark"> Remark : </span>
+ This method is not supported by Web Widget.
+ </p>
<div class="returntype">
<p><span class="return">Return value:</span></p>
Application The data structure that defines the current application.
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onKillSuccess()
{
- console.log("Application terminated successfully");
+ console.log("Application terminated successfully");
}
function onRunningAppsContext(contexts)
{
- /* Let's assume that the application "targetApp0.main" has been installed */
- var targetId = "targetApp0.main";
-
- for (var i = 0; i < contexts.length; i++)
- {
- if (contexts[i].appId == targetId)
- {
- tizen.application.kill(contexts[i].id, onKillSuccess);
- }
- }
+ /* Let's assume that the application "targetApp0.main" has been installed */
+ var targetId = "targetApp0.main";
+
+ for (var i = 0; i < contexts.length; i++)
+ {
+ if (contexts[i].appId == targetId)
+ {
+ tizen.application.kill(contexts[i].id, onKillSuccess);
+ }
+ }
}
tizen.application.getAppsContext(onRunningAppsContext);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess()
{
- console.log("The application has launched successfully");
+ console.log("The application has launched successfully");
}
/* Let's assume that application "targetApp0.main" has been installed */
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
var appControlReplyCallback =
{
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log("Selected image is " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log("The launch application control failed");
+ }
}
tizen.application.launchAppControl(appControl, null,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
</pre>
</div>
</dd>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
function successCB(appInfos, appControl)
{
- /* appControl is same object with the value passed as first parameter to findAppControl() */
- var appControlReplyCallback =
- {
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; /* Select first app's id */
-
- tizen.application.launchAppControl(appControl, appId,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log("Selected image is " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log("The launch application control failed");
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed"); },
+ function(e) {console.log("launch application control failed. reason: " + e.message); },
+ appControlReplyCallback);
}
tizen.application.findAppControl(appControl, successCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onRunningAppsContext(contexts)
{
- for (var i = 0; i < contexts.length; i++)
- console.log("ID: " + contexts[i].id);
+ for (var i = 0; i < contexts.length; i++)
+ console.log("ID: " + contexts[i].id);
}
tizen.application.getAppsContext(onRunningAppsContext);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledApps(applications)
{
- for (var i = 0; i < applications.length; i++)
- console.log("ID: " + applications[i].id);
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
for (var i = 0; i < appCerts.length; i++)
{
- console.log("#" + i + " type:" + appCerts[i].type);
- console.log("#" + i + " value:" + appCerts[i].value);
+ console.log("#" + i + " type:" + appCerts[i].type);
+ console.log("#" + i + " value:" + appCerts[i].value);
}
</pre>
</div>
on a device.
</div>
<p class="deprecated"><b>Deprecated.</b>
- Deprecated since 2.4.
-Instead, let the app developers set a listener for getting notified for the changes(add/remove/update) of applications on a device using <a href="./package.html#PackageManager::setPackageInfoEventListener">tizen.package.setPackageInfoEventListener()</a>.
+ Deprecated since 2.4. Instead, <a href="./package.html#PackageManager::setPackageInfoEventListener">tizen.package.setPackageInfoEventListener()</a> allows the app developers to set a listener for getting notified for the changes(add/remove/update) of applications on a device.
</p>
<div class="synopsis"><pre class="signature prettyprint">long addAppInfoEventListener(<a href="#ApplicationInformationEventCallback">ApplicationInformationEventCallback</a> eventCallback);
</pre></div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is installed");
+ },
+ onupdated: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is updated");
+ },
+ onuninstalled: function(appid)
+ {
+ console.log("The application " + appid + " is uninstalled");
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
</pre>
applications on a device.
</div>
<p class="deprecated"><b>Deprecated.</b>
- Deprecated since 2.4.
-Instead, you can use <a href="./package.html#PackageManager::unsetPackageInfoEventListener">tizen.package.unsetPackageInfoEventListener()</a>.
+ Deprecated since 2.4. Instead, use <a href="./package.html#PackageManager::unsetPackageInfoEventListener">tizen.package.unsetPackageInfoEventListener()</a>.
</p>
<div class="synopsis"><pre class="signature prettyprint">void removeAppInfoEventListener(long watchId);
</pre></div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is installed");
+ },
+ onupdated: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is updated");
+ },
+ onuninstalled: function(appid)
+ {
+ console.log("The application " + appid + " is uninstalled");
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
tizen.application.removeAppInfoEventListener(watchId);
</pre>
</div>
</dd>
+<dt class="method" id="ApplicationManager::addAppStatusChangeListener">
+<a class="backward-compatibility-anchor" name="::Application::ApplicationManager::addAppStatusChangeListener"></a><code><b><span class="methodName">addAppStatusChangeListener</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Adds a listener for receiving any notification for status changes of the installed applications on a device.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">eventCallback</span>:
+ The method to call when status of the installed applications is changed.
+ </li>
+ <li class="param">
+<span class="name">appId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The id of the application which status changes should be monitored. If the application id is ommitted or it is equal to <em>null</em>, all applications status changes will be monitored.
+ </li>
+ </ul>
+</div>
+<div class="returntype">
+<p><span class="return">Return value:</span></p>
+ long Listener id that can be used to remove the listener later.
+ </div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul>
+<li class="list"><p>
+ with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
+ </p></li>
+<li class="list"><p>
+ with error type InvalidValuesError, if the application id parameter is an empty string.
+ </p></li>
+<li class="list"><p>
+ with error type AbortError, if it fails to add a listener.
+ </p></li>
+</ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function appStatusEventCallback(appId, isActive)
+{
+ console.log("The application " + appId + " has been " + (isActive ? "activated" : "deactivated"));
+}
+
+var watchId = tizen.application.addAppStatusChangeListener(appStatusEventCallback);
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> The application testAppId has been activated
+ </pre>
+</div>
+</dd>
+<dt class="method" id="ApplicationManager::removeAppStatusChangeListener">
+<a class="backward-compatibility-anchor" name="::Application::ApplicationManager::removeAppStatusChangeListener"></a><code><b><span class="methodName">removeAppStatusChangeListener</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Removes the listener to stop receiving notifications for status changes of the installed applications on a device.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void removeAppStatusChangeListener(long watchId);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">watchId</span>:
+ An ID that identifies the listener.
+ </li>
+ </ul>
+</div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul><li class="list"><p>
+ with error type AbortError, if it fails to remove listener.
+ </p></li></ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function appStatusEventCallback(appId, isActive)
+{
+ console.log("The application " + appId + " has been " + (isActive ? "activated" : "deactivated"));
+}
+
+try
+{
+ var watchId = tizen.application.addAppStatusChangeListener(appStatusEventCallback);
+ tizen.application.removeAppStatusChangeListener(watchId);
+ console.log("Listener with id " + watchId + " has been removed");
+}
+catch (err)
+{
+ console.log("Exception: " + err.name);
+}
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> Listener with id 1 has been removed
+ </pre>
+</div>
+</dd>
</dl>
</div>
</div>
Since: </span>
2.0
</p>
+<p><span class="remark"> Remark : </span>
+ This method is not supported by Web Widget.
+ </p>
<div class="exceptionlist">
<p><span class="except">Exceptions:</span></p>
<ul class="exception"><li>WebAPIException<ul><li class="list"><p>
Since: </span>
2.0
</p>
+<p><span class="remark"> Remark : </span>
+ This method is not supported by Web Widget.
+ </p>
<div class="exceptionlist">
<p><span class="except">Exceptions:</span></p>
<ul class="exception"><li>WebAPIException<ul><li class="list"><p>
appropriately when it is launched.
</p>
</div>
+<p><span class="remark"> Remark : </span>
+ This method is not supported by Web Widget.
+ </p>
<div class="returntype">
<p><span class="return">Return value:</span></p>
RequestedApplicationControl The details of a requested application control
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
}
</pre>
</div>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- if (appId)
- {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
- {
- console.log("Data: " + JSON.stringify(data));
- /* Do something */
- });
- }
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ });
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
- var watchId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- if (appId)
- {
- watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
- {
- if (watchId)
- {
- app.removeEventListener(watchId);
- watchId = null;
- }
- });
- }
+ var appId = null;
+ var watchId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ if (watchId)
+ {
+ app.removeEventListener(watchId);
+ watchId = null;
+ }
+ });
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var myCustomData =
{
- foo: 'bar'
+ foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var myTrustedCustomData =
{
- foo: 'bar'
+ foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
- null, "image/jpeg", null,
- [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
+ null, "image/jpeg", null,
+ [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
</pre>
</div>
<div class="constructors">
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
-
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
- {
- var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
- reqAppControl.replyResult([data]);
- }
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
+ reqAppControl.replyResult([data]);
+ }
}
</pre>
</div>
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
- {
- reqAppControl.replyFailure();
- }
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ reqAppControl.replyFailure();
+ }
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledApps(applications)
{
- for (var i = 0; i < applications.length; i++)
- console.log("ID: " + applications[i].id);
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
/* FindAppControlSuccessCallback instance */
function successCB(appInfos, appControl)
{
- /* appControl is same object with the value passed as first parameter to findAppControl() */
- var appControlReplyCallback =
- {
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; /* Select first app's id */
-
- tizen.application.launchAppControl(appControl, appId,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log("Selected image is " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log("The launch application control failed");
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed"); },
+ function(e) {console.log("launch application control failed. reason: " + e.message); },
+ appControlReplyCallback);
}
tizen.application.findAppControl(appControl, successCB);
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
/* ApplicationControlDataArrayReplyCallback instance */
var appControlReplyCallback =
{
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log("Selected image is " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log("The launch application control failed");
+ }
}
tizen.application.launchAppControl(appControl, null,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
</pre>
</div>
<div class="methods">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is installed");
+ },
+ onupdated: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is updated");
+ },
+ onuninstalled: function(appid)
+ {
+ console.log("The application " + appid + " is uninstalled");
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
</pre>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- var eventCB = function(event, data)
- {
- console.log("Data: " + JSON.stringify(data));
- /* Do something */
- };
-
- if (appId)
- {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
- }
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ var eventCB = function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ };
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
</dl>
</div>
</div>
+<div class="interface" id="StatusEventCallback">
+<a class="backward-compatibility-anchor" name="::Application::StatusEventCallback"></a><h3>2.18. StatusEventCallback</h3>
+<div class="brief">
+ The StatusEventCallback interface specifies a callback for getting notified when status of the installed application has been changed.
+ </div>
+<pre class="webidl prettyprint"> [Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback {
+ void onchange(<a href="#ApplicationId">ApplicationId</a> appId, boolean isActive);
+ };</pre>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="methods">
+<h4>Methods</h4>
+<dl>
+<dt class="method" id="StatusEventCallback::onchange">
+<a class="backward-compatibility-anchor" name="::Application::StatusEventCallback::onchange"></a><code><b><span class="methodName">onchange</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Called when the status event occurs.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void onchange(<a href="#ApplicationId">ApplicationId</a> appId, boolean isActive);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="description">
+ <p>
+Example of using can be find at <a href="application.html#ApplicationManager::addAppStatusChangeListener">addAppStatusChangeListener</a> code example.
+ </p>
+ </div>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">appId</span>:
+ Id of the application that status has been changed.
+ </li>
+ <li class="param">
+<span class="name">isActive</span>:
+ The new status of the application.
+ </li>
+ </ul>
+</div>
+</dd>
+</dl>
+</div>
+</div>
<div class="dictionary" id="EventInfo">
-<a class="backward-compatibility-anchor" name="::Application::EventInfo"></a><h3>2.18. EventInfo</h3>
+<a class="backward-compatibility-anchor" name="::Application::EventInfo"></a><h3>2.19. EventInfo</h3>
<div class="brief">
The EventInfo dictionary identifies an event with information such as event name. If it is an user event, the broadasting application's identifier is also specified.
</div>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] getAppMetaData(optional <a href="#ApplicationId">ApplicationId</a>? id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- long addAppInfoEventListener(<a href="#ApplicationInformationEventCallback">ApplicationInformationEventCallback</a> eventCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- void removeAppInfoEventListener(long watchId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void removeAppStatusChangeListener(long watchId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
};
[NoInterfaceObject] interface Application {
void onevent(<a href="#EventInfo">EventInfo</a> event, <a href="#EventData">EventData</a> data);
};
+ [Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback {
+ void onchange(<a href="#ApplicationId">ApplicationId</a> appId, boolean isActive);
+ };
+
dictionary EventInfo {
<a href="#ApplicationId">ApplicationId</a> appId;
</li>
<li>2.17. <a href="#EventCallback">EventCallback</a>
</li>
-<li>2.18. <a href="#EventInfo">EventInfo</a>
+<li>2.18. <a href="#StatusEventCallback">StatusEventCallback</a>
+</li>
+<li>2.19. <a href="#EventInfo">EventInfo</a>
</li>
</ul>
</li>
<div>DOMString <a href="#ApplicationManager::getAppSharedURI">getAppSharedURI</a> (optional <a href="#ApplicationId">ApplicationId</a>? id)</div>
<div>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] <a href="#ApplicationManager::getAppMetaData">getAppMetaData</a> (optional <a href="#ApplicationId">ApplicationId</a>? id)</div>
-<div class="deprecated">long <a href="#ApplicationManager::addAppInfoEventListener">addAppInfoEventListener</a> (<a href="#ApplicationInformationEventCallback">ApplicationInformationEventCallback</a> eventCallback)</div>
-<div class="deprecated">void <a href="#ApplicationManager::removeAppInfoEventListener">removeAppInfoEventListener</a> (long watchId)</div>
+<div>long <a href="#ApplicationManager::addAppStatusChangeListener">addAppStatusChangeListener</a> (<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId)</div>
+<div>void <a href="#ApplicationManager::removeAppStatusChangeListener">removeAppStatusChangeListener</a> (long watchId)</div>
</td>
</tr>
<tr>
<td><div>void <a href="#EventCallback::onevent">onevent</a> (<a href="#EventInfo">EventInfo</a> event, <a href="#EventData">EventData</a> data)</div></td>
</tr>
<tr>
+<td><a href="#StatusEventCallback">StatusEventCallback</a></td>
+<td><div>void <a href="#StatusEventCallback::onchange">onchange</a> (<a href="#ApplicationId">ApplicationId</a> appId, boolean isActive)</div></td>
+</tr>
+<tr>
<td><a href="#EventInfo">EventInfo</a></td>
<td></td>
</tr>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] getAppMetaData(optional <a href="#ApplicationId">ApplicationId</a>? id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- long addAppInfoEventListener(<a href="#ApplicationInformationEventCallback">ApplicationInformationEventCallback</a> eventCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- void removeAppInfoEventListener(long watchId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void removeAppStatusChangeListener(long watchId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
};</pre>
<p><span class="version">
Since: </span>
Since: </span>
2.0
</p>
+<p><span class="remark"> Remark : </span>
+ This method is not supported by Web Widget.
+ </p>
<div class="returntype">
<p><span class="return">Return value:</span></p>
Application The data structure that defines the current application.
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onKillSuccess()
{
- console.log("Application terminated successfully");
+ console.log("Application terminated successfully");
}
function onRunningAppsContext(contexts)
{
- /* Let's assume that the application "targetApp0.main" has been installed */
- var targetId = "targetApp0.main";
-
- for (var i = 0; i < contexts.length; i++)
- {
- if (contexts[i].appId == targetId)
- {
- tizen.application.kill(contexts[i].id, onKillSuccess);
- }
- }
+ /* Let's assume that the application "targetApp0.main" has been installed */
+ var targetId = "targetApp0.main";
+
+ for (var i = 0; i < contexts.length; i++)
+ {
+ if (contexts[i].appId == targetId)
+ {
+ tizen.application.kill(contexts[i].id, onKillSuccess);
+ }
+ }
}
tizen.application.getAppsContext(onRunningAppsContext);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onsuccess()
{
- console.log("The application has launched successfully");
+ console.log("The application has launched successfully");
}
/* Let's assume that application "targetApp0.main" has been installed */
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
var appControlReplyCallback =
{
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log("Selected image is " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log("The launch application control failed");
+ }
}
tizen.application.launchAppControl(appControl, null,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
</pre>
</div>
</dd>
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
function successCB(appInfos, appControl)
{
- /* appControl is same object with the value passed as first parameter to findAppControl() */
- var appControlReplyCallback =
- {
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; /* Select first app's id */
-
- tizen.application.launchAppControl(appControl, appId,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log("Selected image is " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log("The launch application control failed");
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed"); },
+ function(e) {console.log("launch application control failed. reason: " + e.message); },
+ appControlReplyCallback);
}
tizen.application.findAppControl(appControl, successCB);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onRunningAppsContext(contexts)
{
- for (var i = 0; i < contexts.length; i++)
- console.log("ID: " + contexts[i].id);
+ for (var i = 0; i < contexts.length; i++)
+ console.log("ID: " + contexts[i].id);
}
tizen.application.getAppsContext(onRunningAppsContext);
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledApps(applications)
{
- for (var i = 0; i < applications.length; i++)
- console.log("ID: " + applications[i].id);
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
for (var i = 0; i < appCerts.length; i++)
{
- console.log("#" + i + " type:" + appCerts[i].type);
- console.log("#" + i + " value:" + appCerts[i].value);
+ console.log("#" + i + " type:" + appCerts[i].type);
+ console.log("#" + i + " value:" + appCerts[i].value);
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is installed");
+ },
+ onupdated: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is updated");
+ },
+ onuninstalled: function(appid)
+ {
+ console.log("The application " + appid + " is uninstalled");
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is installed");
+ },
+ onupdated: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is updated");
+ },
+ onuninstalled: function(appid)
+ {
+ console.log("The application " + appid + " is uninstalled");
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
tizen.application.removeAppInfoEventListener(watchId);
</pre>
</div>
</dd>
+<dt class="method" id="ApplicationManager::addAppStatusChangeListener">
+<a class="backward-compatibility-anchor" name="::Application::ApplicationManager::addAppStatusChangeListener"></a><code><b><span class="methodName">addAppStatusChangeListener</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Adds a listener for receiving any notification for status changes of the installed applications on a device.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">eventCallback</span>:
+ The method to call when status of the installed applications is changed.
+ </li>
+ <li class="param">
+<span class="name">appId</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The id of the application which status changes should be monitored. If the application id is ommitted or it is equal to <em>null</em>, all applications status changes will be monitored.
+ </li>
+ </ul>
+</div>
+<div class="returntype">
+<p><span class="return">Return value:</span></p>
+ long Listener id that can be used to remove the listener later.
+ </div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul>
+<li class="list"><p>
+ with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
+ </p></li>
+<li class="list"><p>
+ with error type InvalidValuesError, if the application id parameter is an empty string.
+ </p></li>
+<li class="list"><p>
+ with error type AbortError, if it fails to add a listener.
+ </p></li>
+</ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function appStatusEventCallback(appId, isActive)
+{
+ console.log("The application " + appId + " has been " + (isActive ? "activated" : "deactivated"));
+}
+
+var watchId = tizen.application.addAppStatusChangeListener(appStatusEventCallback);
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> The application testAppId has been activated
+ </pre>
+</div>
+</dd>
+<dt class="method" id="ApplicationManager::removeAppStatusChangeListener">
+<a class="backward-compatibility-anchor" name="::Application::ApplicationManager::removeAppStatusChangeListener"></a><code><b><span class="methodName">removeAppStatusChangeListener</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Removes the listener to stop receiving notifications for status changes of the installed applications on a device.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void removeAppStatusChangeListener(long watchId);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">watchId</span>:
+ An ID that identifies the listener.
+ </li>
+ </ul>
+</div>
+<div class="exceptionlist">
+<p><span class="except">Exceptions:</span></p>
+ <ul class="exception"><li>WebAPIException<ul><li class="list"><p>
+ with error type AbortError, if it fails to remove listener.
+ </p></li></ul>
+</li></ul>
+ </div>
+<div class="example">
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
+function appStatusEventCallback(appId, isActive)
+{
+ console.log("The application " + appId + " has been " + (isActive ? "activated" : "deactivated"));
+}
+
+try
+{
+ var watchId = tizen.application.addAppStatusChangeListener(appStatusEventCallback);
+ tizen.application.removeAppStatusChangeListener(watchId);
+ console.log("Listener with id " + watchId + " has been removed");
+}
+catch (err)
+{
+ console.log("Exception: " + err.name);
+}
+</pre>
+</div>
+<div class="output">
+<span class="title"><p>Output example:</p></span><pre> Listener with id 1 has been removed
+ </pre>
+</div>
+</dd>
</dl>
</div>
</div>
Since: </span>
2.0
</p>
+<p><span class="remark"> Remark : </span>
+ This method is not supported by Web Widget.
+ </p>
<div class="exceptionlist">
<p><span class="except">Exceptions:</span></p>
<ul class="exception"><li>WebAPIException<ul><li class="list"><p>
Since: </span>
2.0
</p>
+<p><span class="remark"> Remark : </span>
+ This method is not supported by Web Widget.
+ </p>
<div class="exceptionlist">
<p><span class="except">Exceptions:</span></p>
<ul class="exception"><li>WebAPIException<ul><li class="list"><p>
appropriately when it is launched.
</p>
</div>
+<p><span class="remark"> Remark : </span>
+ This method is not supported by Web Widget.
+ </p>
<div class="returntype">
<p><span class="return">Return value:</span></p>
RequestedApplicationControl The details of a requested application control
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
}
</pre>
</div>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- if (appId)
- {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
- {
- console.log("Data: " + JSON.stringify(data));
- /* Do something */
- });
- }
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ });
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
- var watchId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- if (appId)
- {
- watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
- {
- if (watchId)
- {
- app.removeEventListener(watchId);
- watchId = null;
- }
- });
- }
+ var appId = null;
+ var watchId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ if (appId)
+ {
+ watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, function(event, data)
+ {
+ if (watchId)
+ {
+ app.removeEventListener(watchId);
+ watchId = null;
+ }
+ });
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var myCustomData =
{
- foo: 'bar'
+ foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var myTrustedCustomData =
{
- foo: 'bar'
+ foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/view",
- null, "image/jpeg", null,
- [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
+ null, "image/jpeg", null,
+ [new tizen.ApplicationControlData("images", [imagedata1, imagedata2])]);
</pre>
</div>
<div class="constructors">
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
-
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
- {
- var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
- reqAppControl.replyResult([data]);
- }
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
+
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ var data = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selected", ["Image1.jpg"]);
+ reqAppControl.replyResult([data]);
+ }
}
</pre>
</div>
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl)
{
- console.log("Requester AppID: " + reqAppControl.callerAppId);
+ console.log("Requester AppID: " + reqAppControl.callerAppId);
- var appControl = reqAppControl.appControl;
- if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
- {
- reqAppControl.replyFailure();
- }
+ var appControl = reqAppControl.appControl;
+ if (appControl.operation == "http://tizen.org/appcontrol/operation/pick")
+ {
+ reqAppControl.replyFailure();
+ }
}
</pre>
</div>
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
function onListInstalledApps(applications)
{
- for (var i = 0; i < applications.length; i++)
- console.log("ID: " + applications[i].id);
+ for (var i = 0; i < applications.length; i++)
+ console.log("ID: " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
/* FindAppControlSuccessCallback instance */
function successCB(appInfos, appControl)
{
- /* appControl is same object with the value passed as first parameter to findAppControl() */
- var appControlReplyCallback =
- {
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
- }
-
- var appId = appInfos[0].id; /* Select first app's id */
-
- tizen.application.launchAppControl(appControl, appId,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ /* appControl is same object with the value passed as first parameter to findAppControl() */
+ var appControlReplyCallback =
+ {
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log("Selected image is " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log("The launch application control failed");
+ }
+ }
+
+ var appId = appInfos[0].id; /* Select first app's id */
+
+ tizen.application.launchAppControl(appControl, appId,
+ function() {console.log("launch application control succeed"); },
+ function(e) {console.log("launch application control failed. reason: " + e.message); },
+ appControlReplyCallback);
}
tizen.application.findAppControl(appControl, successCB);
<div class="example">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick",
- null, "image/jpeg", null);
+ null, "image/jpeg", null);
/* ApplicationControlDataArrayReplyCallback instance */
var appControlReplyCallback =
{
- /* Callee sent a reply */
- onsuccess: function(data)
- {
- for (var i = 0; i < data.length; i++)
- {
- if (data[i].key == "http://tizen.org/appcontrol/data/selected")
- console.log('Selected image is ' + data[i].value[0]);
- }
- },
- /* Callee returned failure */
- onfailure: function()
- {
- console.log('The launch application control failed');
- }
+ /* Callee sent a reply */
+ onsuccess: function(data)
+ {
+ for (var i = 0; i < data.length; i++)
+ {
+ if (data[i].key == "http://tizen.org/appcontrol/data/selected")
+ console.log("Selected image is " + data[i].value[0]);
+ }
+ },
+ /* Callee returned failure */
+ onfailure: function()
+ {
+ console.log("The launch application control failed");
+ }
}
tizen.application.launchAppControl(appControl, null,
- function() {console.log("launch application control succeed");},
- function(e) {console.log("launch application control failed. reason: " + e.message);},
- appControlReplyCallback);
+ function() {console.log("launch application control succeed");},
+ function(e) {console.log("launch application control failed. reason: " + e.message);},
+ appControlReplyCallback);
</pre>
</div>
<div class="methods">
<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
var appEventCallback =
{
- oninstalled: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is installed');
- },
- onupdated: function(appInfo)
- {
- console.log('The application ' + appInfo.name + ' is updated');
- },
- onuninstalled: function(appid)
- {
- console.log('The application ' + appid + ' is uninstalled');
- }
+ oninstalled: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is installed");
+ },
+ onupdated: function(appInfo)
+ {
+ console.log("The application " + appInfo.name + " is updated");
+ },
+ onuninstalled: function(appid)
+ {
+ console.log("The application " + appid + " is uninstalled");
+ }
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
</pre>
/* Let's assume that at least two applications are installed */
function onListInstalledApps(appsInfo)
{
- var appId = null;
-
- if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
- {
- appId = appsInfo[0].id;
- }
- else if (appsInfo.length > 1)
- {
- appId = appsInfo[1].id;
- }
-
- var eventCB = function(event, data)
- {
- console.log("Data: " + JSON.stringify(data));
- /* Do something */
- };
-
- if (appId)
- {
- var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
- }
+ var appId = null;
+
+ if (appsInfo.length > 0 && app.appInfo.id != appsInfo[0].id)
+ {
+ appId = appsInfo[0].id;
+ }
+ else if (appsInfo.length > 1)
+ {
+ appId = appsInfo[1].id;
+ }
+
+ var eventCB = function(event, data)
+ {
+ console.log("Data: " + JSON.stringify(data));
+ /* Do something */
+ };
+
+ if (appId)
+ {
+ var watchId = app.addEventListener({"appId": appId, "name": "custom_user_event"}, eventCB);
+ }
}
tizen.application.getAppsInfo(onListInstalledApps);
</pre>
</dl>
</div>
</div>
+<div class="interface" id="StatusEventCallback">
+<a class="backward-compatibility-anchor" name="::Application::StatusEventCallback"></a><h3>2.18. StatusEventCallback</h3>
+<div class="brief">
+ The StatusEventCallback interface specifies a callback for getting notified when status of the installed application has been changed.
+ </div>
+<pre class="webidl prettyprint"> [Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback {
+ void onchange(<a href="#ApplicationId">ApplicationId</a> appId, boolean isActive);
+ };</pre>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="methods">
+<h4>Methods</h4>
+<dl>
+<dt class="method" id="StatusEventCallback::onchange">
+<a class="backward-compatibility-anchor" name="::Application::StatusEventCallback::onchange"></a><code><b><span class="methodName">onchange</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Called when the status event occurs.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void onchange(<a href="#ApplicationId">ApplicationId</a> appId, boolean isActive);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="description">
+ <p>
+Example of using can be find at <a href="application.html#ApplicationManager::addAppStatusChangeListener">addAppStatusChangeListener</a> code example.
+ </p>
+ </div>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">appId</span>:
+ Id of the application that status has been changed.
+ </li>
+ <li class="param">
+<span class="name">isActive</span>:
+ The new status of the application.
+ </li>
+ </ul>
+</div>
+</dd>
+</dl>
+</div>
+</div>
<div class="dictionary" id="EventInfo">
-<a class="backward-compatibility-anchor" name="::Application::EventInfo"></a><h3>2.18. EventInfo</h3>
+<a class="backward-compatibility-anchor" name="::Application::EventInfo"></a><h3>2.19. EventInfo</h3>
<div class="brief">
The EventInfo dictionary identifies an event with information such as event name. If it is an user event, the broadasting application's identifier is also specified.
</div>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] getAppMetaData(optional <a href="#ApplicationId">ApplicationId</a>? id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- long addAppInfoEventListener(<a href="#ApplicationInformationEventCallback">ApplicationInformationEventCallback</a> eventCallback) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- void removeAppInfoEventListener(long watchId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void removeAppStatusChangeListener(long watchId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
};
[NoInterfaceObject] interface Application {
void onevent(<a href="#EventInfo">EventInfo</a> event, <a href="#EventData">EventData</a> data);
};
+ [Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback {
+ void onchange(<a href="#ApplicationId">ApplicationId</a> appId, boolean isActive);
+ };
+
dictionary EventInfo {
<a href="#ApplicationId">ApplicationId</a> appId;