From 4c74d0f9fc3d9ced30271ee67c0c8fb7e5f266f4 Mon Sep 17 00:00:00 2001
From: Lukasz Bardeli
Since:
@@ -379,6 +385,9 @@ The tizen.application object allows access to the Application API's fun
Since:
2.0
Remark :
+ This method is not supported by Web Widget.
+ Return value: Code example: Code example: Code example: Code example: Code example: Code example: Code example: Code example:
+ Since:
+ 4.0
+ Parameters: Return value: Exceptions:
+ with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
+
+ with error type InvalidValuesError, if the application id parameter is an empty string.
+
+ with error type AbortError, if it fails to add a listener.
+ Code example: Output example:
+ Since:
+ 4.0
+ Parameters: Exceptions:
+ with error type AbortError, if it fails to remove listener.
+ Code example: Output example:
@@ -217,6 +219,10 @@ For more information on the Application features, see onevent (EventInfo event, EventData data)
+
+StatusEventCallback
+
+
@@ -355,9 +361,9 @@ The tizen.application object allows access to the Application API's fun
ApplicationMetaData[] getAppMetaData(optional ApplicationId? id) raises(WebAPIException);
- long addAppInfoEventListener(ApplicationInformationEventCallback eventCallback) raises(WebAPIException);
+ long addAppStatusChangeListener(StatusEventCallback eventCallback, optional ApplicationId? appId) raises(WebAPIException);
- void removeAppInfoEventListener(long watchId) raises(WebAPIException);
+ void removeAppStatusChangeListener(long watchId) raises(WebAPIException);
};
EventInfo
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);
@@ -551,7 +560,7 @@ UnknownError - If any other error occurs.
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 */
@@ -652,30 +661,30 @@ UnknownError: If any other error occurs.
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);
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);
@@ -815,8 +824,8 @@ UnknownError - If an unknown error occurs.
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);
@@ -917,8 +926,8 @@ UnknownError - If an unknown error occurs.
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);
@@ -1059,8 +1068,8 @@ var appCerts = tizen.application.getAppCerts(null);
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);
}
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);
@@ -1303,24 +1312,137 @@ applications on a device.
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);
addAppStatusChangeListener
+long addAppStatusChangeListener(StatusEventCallback eventCallback, optional ApplicationId? appId);
+
+
+
+
+
+
+function appStatusEventCallback(appId, isActive)
+{
+ console.log("The application " + appId + " has been " + (isActive ? "activated" : "deactivated"));
+}
+
+var watchId = tizen.application.addAppStatusChangeListener(appStatusEventCallback);
+
+ The application testAppId has been activated
+
+removeAppStatusChangeListener
+void removeAppStatusChangeListener(long watchId);
+
+
+
+
+
+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);
+}
+
+ Listener with id 1 has been removed
+
+
Remark : + This method is not supported by Web Widget. +
Exceptions:
@@ -1423,6 +1548,9 @@ app.exit(); Since: 2.0
+Remark : + This method is not supported by Web Widget. +
Exceptions:
@@ -1463,6 +1591,9 @@ responsible for checking the contents of the application control and responding appropriately when it is launched.
Remark : + This method is not supported by Web Widget. +
Return value:
RequestedApplicationControl The details of a requested application control @@ -1480,7 +1611,7 @@ var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppCon if (reqAppControl) { - console.log("Requester AppID: " + reqAppControl.callerAppId); + console.log("Requester AppID: " + reqAppControl.callerAppId); }Code example:
var myCustomData = { - foo: 'bar' + foo: 'bar' }; var app = tizen.application.getCurrentApplication(); @@ -1732,7 +1863,7 @@ An application can listen to events from other applications. However, it can onlCode example:
var myTrustedCustomData = { - foo: 'bar' + foo: 'bar' }; var app = tizen.application.getCurrentApplication(); @@ -2013,8 +2144,8 @@ and launches the selected application.Code example:
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])]);@@ -2177,14 +2308,14 @@ It contains the information that the calling application passed to launchApp 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]); + } }@@ -2220,13 +2351,13 @@ to perform the requested action. 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(); + } }
Code example:
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); @@ -2424,36 +2555,36 @@ It is used in ApplicationManager.findAppControl().+Code example:
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); @@ -2538,31 +2669,31 @@ This callback interface specifies two methods:Code example:
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);@@ -2635,18 +2766,18 @@ an application is installed, updated, or uninstalled.Code example:
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);@@ -2794,27 +2925,27 @@ var app = tizen.application.getCurrentApplication(); /* 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); @@ -2823,8 +2954,58 @@ tizen.application.getAppsInfo(onListInstalledApps);+2.18. StatusEventCallback
++ The StatusEventCallback interface specifies a callback for getting notified when status of the installed application has been changed. ++[Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback { + void onchange(ApplicationId appId, boolean isActive); + };++ Since: + 4.0 +
+++Methods
++
+- +
+onchange
+- +
++ Called when the status event occurs. +++void onchange(ApplicationId appId, boolean isActive); ++ Since: + 4.0 +
++++Example of using can be find at addAppStatusChangeListener code example. +
+++Parameters:
++
+- +appId: + Id of the application that status has been changed. +
+- +isActive: + The new status of the application. +
+--2.18. EventInfo
+2.19. EventInfo
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.@@ -2939,9 +3120,9 @@ Must be at least 1 byte in length and not exceed the maximum name length of 127 ApplicationMetaData[] getAppMetaData(optional ApplicationId? id) raises(WebAPIException); - long addAppInfoEventListener(ApplicationInformationEventCallback eventCallback) raises(WebAPIException); + long addAppStatusChangeListener(StatusEventCallback eventCallback, optional ApplicationId? appId) raises(WebAPIException); - void removeAppInfoEventListener(long watchId) raises(WebAPIException); + void removeAppStatusChangeListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface Application { @@ -3080,6 +3261,10 @@ Must be at least 1 byte in length and not exceed the maximum name length of 127 void onevent(EventInfo event, EventData data); }; + [Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback { + void onchange(ApplicationId appId, boolean isActive); + }; + dictionary EventInfo { ApplicationId appId; diff --git a/org.tizen.web.apireference/html/device_api/tv/tizen/application.html b/org.tizen.web.apireference/html/device_api/tv/tizen/application.html index cf7b180..5493f61 100644 --- a/org.tizen.web.apireference/html/device_api/tv/tizen/application.html +++ b/org.tizen.web.apireference/html/device_api/tv/tizen/application.html @@ -93,7 +93,9 @@ For more information on the Application features, see EventCallback -2.18. EventInfo + 2.18. StatusEventCallback + +2.19. EventInfo @@ -132,8 +134,8 @@ For more information on the Application features, see getAppSharedURI (optional ApplicationId? id)long addAppInfoEventListener (ApplicationInformationEventCallback eventCallback)-void removeAppInfoEventListener (long watchId)+ +void removeAppStatusChangeListener (long watchId)@@ -216,6 +218,10 @@ For more information on the Application features, see onevent (EventInfo event, EventData data) + +StatusEventCallback ++ void onchange (ApplicationId appId, boolean isActive)@@ -354,9 +360,9 @@ The tizen.application object allows access to the Application API's fun ApplicationMetaData[] getAppMetaData(optional ApplicationId? id) raises(WebAPIException); - long addAppInfoEventListener(ApplicationInformationEventCallback eventCallback) raises(WebAPIException); + long addAppStatusChangeListener(StatusEventCallback eventCallback, optional ApplicationId? appId) raises(WebAPIException); - void removeAppInfoEventListener(long watchId) raises(WebAPIException); + void removeAppStatusChangeListener(long watchId) raises(WebAPIException); }; EventInfo
Since: @@ -378,6 +384,9 @@ The tizen.application object allows access to the Application API's fun Since: 2.0
+Remark : + This method is not supported by Web Widget. +
Return value:
Application The data structure that defines the current application. @@ -464,21 +473,21 @@ UnknownError - If any other error occurs.Code example:
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); @@ -550,7 +559,7 @@ UnknownError - If any other error occurs.Code example:
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 */ @@ -651,30 +660,30 @@ UnknownError: If any other error occurs.@@ -732,35 +741,35 @@ UnknownError - If any other error occurs.Code example:
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);@@ -1186,8 +1195,7 @@ console.log("size of metadata: " + metaDataArray.length); on a device.Code example:
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); @@ -814,8 +823,8 @@ UnknownError - If an unknown error occurs.Code example:
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); @@ -916,8 +925,8 @@ UnknownError - If an unknown error occurs.Code example:
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); @@ -1058,8 +1067,8 @@ var appCerts = tizen.application.getAppCerts(null); 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); }
Deprecated. - 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 tizen.package.setPackageInfoEventListener(). + Deprecated since 2.4. Instead, tizen.package.setPackageInfoEventListener() allows the app developers to set a listener for getting notified for the changes(add/remove/update) of applications on a device.
long addAppInfoEventListener(ApplicationInformationEventCallback eventCallback);
Code example:
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);@@ -1270,8 +1278,7 @@ var watchId = tizen.application.addAppInfoEventListener(appEventCallback); applications on a device.
Deprecated. - Deprecated since 2.4. -Instead, you can use tizen.package.unsetPackageInfoEventListener(). + Deprecated since 2.4. Instead, use tizen.package.unsetPackageInfoEventListener().
void removeAppInfoEventListener(long watchId);
Code example:
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);+
addAppStatusChangeListener
+long addAppStatusChangeListener(StatusEventCallback eventCallback, optional ApplicationId? appId); +
+ Since: + 4.0 +
+Parameters:
+Return value:
+ long Listener id that can be used to remove the listener later. +Exceptions:
++ with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter. +
+ with error type InvalidValuesError, if the application id parameter is an empty string. +
+ with error type AbortError, if it fails to add a listener. +
Code example:
+function appStatusEventCallback(appId, isActive) +{ + console.log("The application " + appId + " has been " + (isActive ? "activated" : "deactivated")); +} + +var watchId = tizen.application.addAppStatusChangeListener(appStatusEventCallback); ++
Output example:
The application testAppId has been activated ++
removeAppStatusChangeListener
+void removeAppStatusChangeListener(long watchId); +
+ Since: + 4.0 +
+Parameters:
+Exceptions:
++ with error type AbortError, if it fails to remove listener. +
Code example:
+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); +} ++
Output example:
Listener with id 1 has been removed ++
Remark : + This method is not supported by Web Widget. +
Exceptions:
@@ -1424,6 +1547,9 @@ app.exit(); Since: 2.0
+Remark : + This method is not supported by Web Widget. +
Exceptions:
@@ -1464,6 +1590,9 @@ responsible for checking the contents of the application control and responding appropriately when it is launched.
Remark : + This method is not supported by Web Widget. +
Return value:
RequestedApplicationControl The details of a requested application control @@ -1481,7 +1610,7 @@ var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppCon if (reqAppControl) { - console.log("Requester AppID: " + reqAppControl.callerAppId); + console.log("Requester AppID: " + reqAppControl.callerAppId); }Code example:
var myCustomData = { - foo: 'bar' + foo: 'bar' }; var app = tizen.application.getCurrentApplication(); @@ -1733,7 +1862,7 @@ An application can listen to events from other applications. However, it can onlCode example:
var myTrustedCustomData = { - foo: 'bar' + foo: 'bar' }; var app = tizen.application.getCurrentApplication(); @@ -2014,8 +2143,8 @@ and launches the selected application.Code example:
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])]);@@ -2178,14 +2307,14 @@ It contains the information that the calling application passed to launchApp 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]); + } }@@ -2221,13 +2350,13 @@ to perform the requested action. 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(); + } }
Code example:
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); @@ -2425,36 +2554,36 @@ It is used in ApplicationManager.findAppControl().+Code example:
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); @@ -2539,31 +2668,31 @@ This callback interface specifies two methods:Code example:
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);@@ -2636,18 +2765,18 @@ an application is installed, updated, or uninstalled.Code example:
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);@@ -2795,27 +2924,27 @@ var app = tizen.application.getCurrentApplication(); /* 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); @@ -2824,8 +2953,58 @@ tizen.application.getAppsInfo(onListInstalledApps);+2.18. StatusEventCallback
++ The StatusEventCallback interface specifies a callback for getting notified when status of the installed application has been changed. ++[Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback { + void onchange(ApplicationId appId, boolean isActive); + };++ Since: + 4.0 +
+++Methods
++
+- +
+onchange
+- +
++ Called when the status event occurs. +++void onchange(ApplicationId appId, boolean isActive); ++ Since: + 4.0 +
++++Example of using can be find at addAppStatusChangeListener code example. +
+++Parameters:
++
+- +appId: + Id of the application that status has been changed. +
+- +isActive: + The new status of the application. +
+--2.18. EventInfo
+2.19. EventInfo
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.@@ -2940,9 +3119,9 @@ Must be at least 1 byte in length and not exceed the maximum name length of 127 ApplicationMetaData[] getAppMetaData(optional ApplicationId? id) raises(WebAPIException); - long addAppInfoEventListener(ApplicationInformationEventCallback eventCallback) raises(WebAPIException); + long addAppStatusChangeListener(StatusEventCallback eventCallback, optional ApplicationId? appId) raises(WebAPIException); - void removeAppInfoEventListener(long watchId) raises(WebAPIException); + void removeAppStatusChangeListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface Application { @@ -3081,6 +3260,10 @@ Must be at least 1 byte in length and not exceed the maximum name length of 127 void onevent(EventInfo event, EventData data); }; + [Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback { + void onchange(ApplicationId appId, boolean isActive); + }; + dictionary EventInfo { ApplicationId appId; diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/application.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/application.html index e932368..3cd0097 100644 --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/application.html +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/application.html @@ -94,7 +94,9 @@ For more information on the Application features, see EventCallback -2.18. EventInfo + 2.18. StatusEventCallback + +2.19. EventInfo @@ -133,8 +135,8 @@ For more information on the Application features, see getAppSharedURI (optional ApplicationId? id)long addAppInfoEventListener (ApplicationInformationEventCallback eventCallback)-void removeAppInfoEventListener (long watchId)+ +void removeAppStatusChangeListener (long watchId)@@ -217,6 +219,10 @@ For more information on the Application features, see onevent (EventInfo event, EventData data) + +StatusEventCallback ++ void onchange (ApplicationId appId, boolean isActive)@@ -355,9 +361,9 @@ The tizen.application object allows access to the Application API's fun ApplicationMetaData[] getAppMetaData(optional ApplicationId? id) raises(WebAPIException); - long addAppInfoEventListener(ApplicationInformationEventCallback eventCallback) raises(WebAPIException); + long addAppStatusChangeListener(StatusEventCallback eventCallback, optional ApplicationId? appId) raises(WebAPIException); - void removeAppInfoEventListener(long watchId) raises(WebAPIException); + void removeAppStatusChangeListener(long watchId) raises(WebAPIException); }; EventInfo
Since: @@ -379,6 +385,9 @@ The tizen.application object allows access to the Application API's fun Since: 2.0
+Remark : + This method is not supported by Web Widget. +
Return value:
Application The data structure that defines the current application. @@ -465,21 +474,21 @@ UnknownError - If any other error occurs.Code example:
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); @@ -551,7 +560,7 @@ UnknownError - If any other error occurs.Code example:
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 */ @@ -652,30 +661,30 @@ UnknownError: If any other error occurs.@@ -733,35 +742,35 @@ UnknownError - If any other error occurs.Code example:
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);@@ -1244,18 +1253,18 @@ with the corresponding listener identifier.Code example:
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); @@ -815,8 +824,8 @@ UnknownError - If an unknown error occurs.Code example:
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); @@ -917,8 +926,8 @@ UnknownError - If an unknown error occurs.Code example:
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); @@ -1059,8 +1068,8 @@ var appCerts = tizen.application.getAppCerts(null); 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); }Code example:
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);@@ -1303,24 +1312,137 @@ applications on a device.Code example:
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);
addAppStatusChangeListener
+long addAppStatusChangeListener(StatusEventCallback eventCallback, optional ApplicationId? appId); +
+ Since: + 4.0 +
+Parameters:
+Return value:
+ long Listener id that can be used to remove the listener later. +Exceptions:
++ with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter. +
+ with error type InvalidValuesError, if the application id parameter is an empty string. +
+ with error type AbortError, if it fails to add a listener. +
Code example:
+function appStatusEventCallback(appId, isActive) +{ + console.log("The application " + appId + " has been " + (isActive ? "activated" : "deactivated")); +} + +var watchId = tizen.application.addAppStatusChangeListener(appStatusEventCallback); ++
Output example:
The application testAppId has been activated ++
removeAppStatusChangeListener
+void removeAppStatusChangeListener(long watchId); +
+ Since: + 4.0 +
+Parameters:
+Exceptions:
++ with error type AbortError, if it fails to remove listener. +
Code example:
+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); +} ++
Output example:
Listener with id 1 has been removed ++
Remark : + This method is not supported by Web Widget. +
Exceptions:
@@ -1423,6 +1548,9 @@ app.exit(); Since: 2.0
+Remark : + This method is not supported by Web Widget. +
Exceptions:
@@ -1463,6 +1591,9 @@ responsible for checking the contents of the application control and responding appropriately when it is launched.
Remark : + This method is not supported by Web Widget. +
Return value:
RequestedApplicationControl The details of a requested application control @@ -1480,7 +1611,7 @@ var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppCon if (reqAppControl) { - console.log("Requester AppID: " + reqAppControl.callerAppId); + console.log("Requester AppID: " + reqAppControl.callerAppId); }Code example:
var myCustomData = { - foo: 'bar' + foo: 'bar' }; var app = tizen.application.getCurrentApplication(); @@ -1732,7 +1863,7 @@ An application can listen to events from other applications. However, it can onlCode example:
var myTrustedCustomData = { - foo: 'bar' + foo: 'bar' }; var app = tizen.application.getCurrentApplication(); @@ -2013,8 +2144,8 @@ and launches the selected application.Code example:
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])]);@@ -2177,14 +2308,14 @@ It contains the information that the calling application passed to launchApp 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]); + } }@@ -2220,13 +2351,13 @@ to perform the requested action. 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(); + } }
Code example:
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); @@ -2424,36 +2555,36 @@ It is used in ApplicationManager.findAppControl().+Code example:
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); @@ -2538,31 +2669,31 @@ This callback interface specifies two methods:Code example:
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);@@ -2635,18 +2766,18 @@ an application is installed, updated, or uninstalled.Code example:
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);@@ -2794,27 +2925,27 @@ var app = tizen.application.getCurrentApplication(); /* 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); @@ -2823,8 +2954,58 @@ tizen.application.getAppsInfo(onListInstalledApps);+2.18. StatusEventCallback
++ The StatusEventCallback interface specifies a callback for getting notified when status of the installed application has been changed. ++[Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback { + void onchange(ApplicationId appId, boolean isActive); + };++ Since: + 4.0 +
+++Methods
++
+- +
+onchange
+- +
++ Called when the status event occurs. +++void onchange(ApplicationId appId, boolean isActive); ++ Since: + 4.0 +
++++Example of using can be find at addAppStatusChangeListener code example. +
+++Parameters:
++
+- +appId: + Id of the application that status has been changed. +
+- +isActive: + The new status of the application. +
+-2.18. EventInfo
+2.19. EventInfo
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.@@ -2939,9 +3120,9 @@ Must be at least 1 byte in length and not exceed the maximum name length of 127 ApplicationMetaData[] getAppMetaData(optional ApplicationId? id) raises(WebAPIException); - long addAppInfoEventListener(ApplicationInformationEventCallback eventCallback) raises(WebAPIException); + long addAppStatusChangeListener(StatusEventCallback eventCallback, optional ApplicationId? appId) raises(WebAPIException); - void removeAppInfoEventListener(long watchId) raises(WebAPIException); + void removeAppStatusChangeListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface Application { @@ -3080,6 +3261,10 @@ Must be at least 1 byte in length and not exceed the maximum name length of 127 void onevent(EventInfo event, EventData data); }; + [Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback { + void onchange(ApplicationId appId, boolean isActive); + }; + dictionary EventInfo { ApplicationId appId; -- 2.7.4