The ApplicationManager interface also provides methods to launch other applications explicitly and implicitly through the ApplicationControl interface. The ApplicationControl interface consists of an operation, URI, and MIME type and also describes an action to be performed by other applications and can carry the result from the subsequent application. The ApplicationManager interface also provides methods to handle the application lifecycle, to access the installed applications on the device, and to let an application be notified of a change in the application list.
The Application interface defines the current application's information and the basic operations for the current application such as exit or hide.
Since Tizen 2.4 the Application interface provides application event broadcasting and listening features. An application can broadcast user events to other listening applications and listen to broadcasted user events from other applications. In a future Tizen release, applications will also be able to receive pre-defined system events from the platform.
For more information on the Application features, see Application Guide, Application Group Guide or Application Control Guide.
Since: 2.4
typedef DOMString ApplicationId;
Since: 2.4
typedef DOMString ApplicationContextId;
Since: 2.4
typedef (SystemEventData or UserEventData) EventData;
Since: 2.4
enum ApplicationControlLaunchMode { "SINGLE", "GROUP" };
Since: 2.4
The launch modes defined by this enumerator are:
enum ApplicationUsageMode { "RECENTLY", "FREQUENTLY" };
Since: 4.0
Possible types are:
[NoInterfaceObject] interface ApplicationManagerObject {
readonly attribute ApplicationManager application;
};
Tizen implements ApplicationManagerObject;
Since: 2.4
The tizen.application object allows access to the Application API's functionality.
[NoInterfaceObject] interface ApplicationManager {
Application getCurrentApplication() raises(WebAPIException);
void kill(ApplicationContextId contextId,
optional SuccessCallback? successCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
void launch(ApplicationId id,
optional SuccessCallback? successCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
void launchAppControl(ApplicationControl appControl,
optional ApplicationId? id,
optional SuccessCallback? successCallback,
optional ErrorCallback? errorCallback,
optional ApplicationControlDataArrayReplyCallback? replyCallback) raises(WebAPIException);
void findAppControl(ApplicationControl appControl,
FindAppControlSuccessCallback successCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
void getAppsContext(ApplicationContextArraySuccessCallback successCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
ApplicationContext getAppContext(optional ApplicationContextId? contextId) raises(WebAPIException);
void getAppsInfo(ApplicationInformationArraySuccessCallback successCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
ApplicationInformation getAppInfo(optional ApplicationId? id) raises(WebAPIException);
ApplicationCertificate[] getAppCerts(optional ApplicationId? id) raises(WebAPIException);
DOMString getAppSharedURI(optional ApplicationId? id) raises(WebAPIException);
ApplicationMetaData[] getAppMetaData(optional ApplicationId? id) raises(WebAPIException);
void getBatteryUsageInfo(BatteryUsageInfoArraySuccessCallback successCallback,
optional ErrorCallback? errorCallback,
optional long? days,
optional long? limit) raises(WebAPIException);
void getAppsUsageInfo(AppsUsageInfoArraySuccessCallback successCallback,
optional ErrorCallback? errorCallback,
optional ApplicationUsageMode? mode,
optional ApplicationUsageFilter? filter,
optional long? limit) raises(WebAPIException);
long addAppStatusChangeListener(StatusEventCallback eventCallback, optional ApplicationId? appId) raises(WebAPIException);
void removeAppStatusChangeListener(long watchId) raises(WebAPIException);
};
Since: 2.4
getCurrentApplication
Application getCurrentApplication();
Since: 2.4
Remark : This method is not supported by Web Widget.
Return value:
Application The data structure that defines the current application.Exceptions:
with error type UnknownError, if the application cannot be retrieved because of an unknown error.
Code example:
var app = tizen.application.getCurrentApplication();
console.log("Current application's app id is " + app.appInfo.id);
kill
void kill(ApplicationContextId contextId, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 2.4
The ErrorCallback method is launched with these error types:
Privilege level: partner
Privilege: http://tizen.org/privilege/appmanager.kill
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
Code example:
function onKillSuccess() {
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);
}
}
}
tizen.application.getAppsContext(onRunningAppsContext);
launch
void launch(ApplicationId id, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 2.4
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/application.launch
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
Code example:
function onsuccess() {
console.log("The application has launched successfully");
}
// let's assume that application "targetApp0.main" has been installed
tizen.application.launch("targetApp0.main", onsuccess);
launchAppControl
void launchAppControl(ApplicationControl appControl, optional ApplicationId? id, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback, optional ApplicationControlDataArrayReplyCallback? replyCallback);
Since: 2.4
An application can launch other applications with the application control, and get back the results from the launched applications.
The application control consists of an operation, URI, and MIME type, and describes the request to be performed by the newly launched application. The application control is passed to the launchAppControl() method to launch an application. The system tries to find the proper application to perform the requested application control, then launches the selected application.
The application control request is passed to the newly launched application and it can be accessed by the getRequestedAppControl() method. The passed application control contains the reason the application has been launched and information about what the application is doing. The launched application can send a result to the caller application with the replyResult() method of the RequestedApplicationControl interface.
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/application.launch
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
Code example:
var appControl = new tizen.ApplicationControl(
"http://tizen.org/appcontrol/operation/pick",
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');
}
}
tizen.application.launchAppControl(
appControl,
null,
function() {console.log("launch application control succeed"); },
function(e) {console.log("launch application control failed. reason: " + e.message); },
appControlReplyCallback );
findAppControl
void findAppControl(ApplicationControl appControl, FindAppControlSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 2.4
An application can get a list of other applications that can be launched with the application control.
The ErrorCallback method is launched with these error types:
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
Code example:
var appControl = new tizen.ApplicationControl(
"http://tizen.org/appcontrol/operation/pick",
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 );
}
tizen.application.findAppControl(appControl, successCB);
getAppsContext
void getAppsContext(ApplicationContextArraySuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 2.4
The ErrorCallback method is launched with this error type:
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
Code example:
function onRunningAppsContext(contexts) {
for (var i = 0; i < contexts.length; i++)
console.log("ID : " + contexts[i].id);
}
tizen.application.getAppsContext(onRunningAppsContext);
getAppContext
ApplicationContext getAppContext(optional ApplicationContextId? contextId);
Since: 2.4
Parameters:
Return value:
ApplicationContext A data structure that lists running application details.Exceptions:
with error type NotFoundError, if the application context is not found with the specified ID.
with error type UnknownError, if the application context cannot be retrieved because of an unknown error.
Code example:
var appContext = tizen.application.getAppContext(null);
console.log("Application context retrieved for app " + appContext.appId);
getAppsInfo
void getAppsInfo(ApplicationInformationArraySuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 2.4
The ErrorCallback method is launched with this error type:
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
Code example:
function onListInstalledApps(applications) {
for (var i = 0; i < applications.length; i++)
console.log("ID : " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
getAppInfo
ApplicationInformation getAppInfo(optional ApplicationId? id);
Since: 2.4
If the ID is set to null or not set at all, it returns application information for the current application. The list of installed applications and their application IDs is obtained with getAppsInfo().
Parameters:
Return value:
ApplicationInformation The information of an application.Exceptions:
with error type NotFoundError, if the application is not found with the specified ID.
with error type UnknownError, if the application cannot be retrieved because of an unknown error.
Code example:
var appInfo = tizen.application.getAppInfo(null);
console.log("Current application name : " + appInfo.name);
getAppCerts
ApplicationCertificate[] getAppCerts(optional ApplicationId? id);
Since: 2.4
If the ID is set to null or not set at all, it returns application certificates for the current application.
The certificate types are listed below:
Privilege level: partner
Privilege: http://tizen.org/privilege/appmanager.certificate
Parameters:
Return value:
ApplicationCertificate[] Array of certificate information of a specified applicationExceptions:
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotFoundError, if the application is not found with the specified ID.
with error type UnknownError, if the application cannot be retrieved because of an unknown error.
Code example:
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);
}
DOMString getAppSharedURI(optional ApplicationId? id);
Since: 2.4
The shared directory is used to export data to other applications. If the ID is set to null or not set at all, it returns the shared directory URI for the current application.
Parameters:
Return value:
DOMString The shared directory URI of an applicationExceptions:
with error type NotFoundError, if the application is not found with the specified ID.
with error type UnknownError, if the application cannot be retrieved because of an unknown error.
Code example:
var sharedDir = tizen.application.getAppSharedURI(null);
console.log("shared directory : " + sharedDir);
getAppMetaData
ApplicationMetaData[] getAppMetaData(optional ApplicationId? id);
Since: 2.4
If the ID is set to null or not set at all, it returns the application meta data array for the current application.
Privilege level: public
Privilege: http://tizen.org/privilege/application.info
Parameters:
Return value:
ApplicationMetaData[] Array of meta data of a specified application. If there are no meta data for a specified application, an empty array is returnedExceptions:
with error type SecurityError, if the application does not have the privilege to call this method.
with error type NotFoundError, if the application is not found with the specified ID.
with error type UnknownError, if the application cannot be retrieved because of an unknown error.
Code example:
var metaDataArray = tizen.application.getAppMetaData(null);
console.log("size of metadata : " + metaDataArray.length);
getBatteryUsageInfo
void getBatteryUsageInfo(BatteryUsageInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional long? days, optional long? limit);
Since: 4.0
This method provides information about battery usage collected in last days days, through callback successCallback. Maximum number of retrieved objects can be set in limit parameter.
If the days is not given, this method retrieves information about battery usage since the time the device was unplugged, after reaching full charge.
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/apphistory.read
Remark : This method is available only on mobile devices. An attempt to call this method on other profile will result in throwing NotSupportedError exception.
Parameters:
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
Code example:
var successCallback = function(batteryUsageInfoArray)
{
batteryUsageInfoArray.forEach(function(abuInfo)
{
console.log("ApplicationID: " + abuInfo.appId + ", usage: " + abuInfo.batteryUsage);
});
};
tizen.application.getBatteryUsageInfo(successCallback);
Output example:
ApplicationID: 3gWRkEPXz5.BasicUI3, usage: 51.78 ApplicationID: org.tizen.homescreen-efl, usage: 28.72 ApplicationID: org.tizen.lockscreen, usage: 6.05 ApplicationID: org.tizen.quickpanel, usage: 4.83 ApplicationID: org.tizen.indicator, usage: 3.69 ApplicationID: org.tizen.calendar.widget, usage: 1.79 ApplicationID: org.tizen.volume, usage: 1.34 ApplicationID: org.tizen.powerkey-syspopup, usage: 0.98 ApplicationID: org.tizen.task-mgr, usage: 0.46 ApplicationID: org.tizen.msg-manager, usage: 0.36
getAppsUsageInfo
void getAppsUsageInfo(AppsUsageInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback, optional ApplicationUsageMode? mode, optional ApplicationUsageFilter? filter, optional long? limit);
Since: 4.0
The method gets the most frequently or recently used applications statistics, depending on parameter mode, which meet conditions in filter object. Maximum number of retrieved objects can be set in limit parameter.
Applications which have not been used will not be included in results.
If an attribute endTime from filter object is less than or equal to startTime date, an empty array will be returned.
The ErrorCallback method is launched with these error types:
Privilege level: public
Privilege: http://tizen.org/privilege/apphistory.read
Remark : This method is available only on mobile devices. An attempt to call this method on other profile will result in throwing NotSupportedError exception.
Parameters:
Exceptions:
with error type NotSupportedError, if this feature is not supported.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
Code example:
var successCallback = function(appsUsageInfo)
{
appsUsageInfo.forEach(function(auInfo)
{
console.log("ApplicationID: " + auInfo.appId + ", count: " + auInfo.totalCount +
", duration: " + auInfo.totalDuration + ", last used at: " + auInfo.lastTime);
});
};
tizen.application.getAppsUsageInfo(successCallback, null, "FREQUENTLY", {timeSpan: 7}, 5);
Output example:
ApplicationID: w5ucNMnbVi.BasicUI, count: 17, duration: 3471, last used at: Tue Aug 01 2017 12:13:06 GMT+0200 (CEST) ApplicationID: org.tizen.message, count: 16, duration: 2964, last used at: Wed Aug 02 2017 08:22:14 GMT+0200 (CEST) ApplicationID: api1getcap.sysinfo, count: 16, duration: 1957, last used at: Tue Aug 01 2017 12:13:03 GMT+0200 (CEST) ApplicationID: org.tizen.email, count: 10, duration: 1209, last used at: Fri Jul 21 2017 10:15:09 GMT+0200 (CEST) ApplicationID: org.tizen.setting, count: 5, duration: 519, last used at: Wed Aug 02 2017 06:52:51 GMT+0200 (CEST)
addAppInfoEventListener
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().
long addAppInfoEventListener(ApplicationInformationEventCallback eventCallback);
Since: 2.4
It installs a callback that is triggered every time a change occurs on the list of installed applications on a device. This change may occur due to a new installation, uninstallation, or update of an application.
When executed, the implementation must immediately return a listener ID that identifies the listener. After returning the ID, the change detection operation is started asynchronously.
The ApplicationInformationEventCallback must be invoked every time a new application is installed, removed, or updated.
The change detection must continue until the removeAppInfoEventListener() method is called with the corresponding listener identifier.
Parameters:
Return value:
long ID of the listener 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 UnknownError, if it fails to add a listener because of an unknown error.
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');
}
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
removeAppInfoEventListener
Deprecated. Deprecated since 2.4. Instead, you can use tizen.package.unsetPackageInfoEventListener().
void removeAppInfoEventListener(long watchId);
Since: 2.4
Parameters:
Exceptions:
with error type NotFoundError, if the listener is not found with the specified ID.
with error type UnknownError, if it fails to remove a listener because of an unknown error.
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');
}
};
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
dictionary ApplicationUsageFilter {
long? timeSpan;
Date? startTime;
Date? endTime;
};
Since: 4.0
The maximum retention period is 90 days.
If the attribute is given, the attributes startTime and endTime of this interface are not taken into an account. If timeSpan is greater than 90, 90 will be used instead.
Since: 4.0
If only startTime attribute is given, by default endTime is equal to the current date. If startTime date predates the 90 days from the current time, data will be accumulated from last 90 days.
Since: 4.0
If only endTime attribute is given, data will be accumulated from 90 days ago to endTime date.
Since: 4.0
[NoInterfaceObject] interface Application {
readonly attribute ApplicationInformation appInfo;
readonly attribute ApplicationContextId contextId;
void exit() raises(WebAPIException);
void hide() raises(WebAPIException);
RequestedApplicationControl getRequestedAppControl() raises(WebAPIException);
long addEventListener(EventInfo event, EventCallback callback) raises(WebAPIException);
void removeEventListener(long watchId) raises(WebAPIException);
void broadcastEvent(EventInfo event, UserEventData data) raises(WebAPIException);
void broadcastTrustedEvent(EventInfo event, UserEventData data) raises(WebAPIException);
};
Since: 2.4
Since: 2.4
Since: 2.4
exit
void exit();
Since: 2.4
Remark : This method is not supported by Web Widget.
Exceptions:
with error type UnknownError, if any other error occurs.
Code example:
var app = tizen.application.getCurrentApplication();
app.exit();
hide
void hide();
Since: 2.4
Remark : This method is not supported by Web Widget.
Exceptions:
with error type UnknownError, if any other error occurs.
Code example:
var app = tizen.application.getCurrentApplication();
app.hide();
getRequestedAppControl
RequestedApplicationControl getRequestedAppControl();
Since: 2.4
Gets the requested application control that contains the application control passed by the launchAppControl() method from the calling application. The requested application control contains the reason the application is launched and what it has to perform. For example, an application might be launched to display an image on a page by another application's request. In all of these cases, the application is 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 controlExceptions:
with error type UnknownError, if the application control cannot be retrieved because of an unknown error.
Code example:
var reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();
if (reqAppControl) {
console.log("Requester AppID : " + reqAppControl.callerAppId);
}
addEventListener
long addEventListener(EventInfo event, EventCallback callback);
Since: 2.4
System events do not require an application identifier to be specified. Therefore, the appId attribute of the EventInfo dictionary should not be specified when listening for system events. If it is specified, the event to listen for will be interpreted as an user event.
Parameters:
Return value:
long Listener identifierExceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type.
with error type UnknownError in any other error case.
Code example:
var app = tizen.application.getCurrentApplication();
// for user events: sender's application ID and event name must be provided by using a dictionary
// 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
});
}
}
tizen.application.getAppsInfo(onListInstalledApps);
removeEventListener
void removeEventListener(long watchId);
Since: 2.4
Parameters:
Exceptions:
with error type UnknownError in any other error case.
Code example:
var app = tizen.application.getCurrentApplication();
// for user events: sender's application ID and event name must be provided by using a dictionary
// 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;
}
});
}
}
tizen.application.getAppsInfo(onListInstalledApps);
broadcastEvent
void broadcastEvent(EventInfo event, UserEventData data);
Since: 2.4
An application can listen to events from other applications. However, it can only broadcast its own events. Therefore, the appId attribute of the EventInfo dictionary must be the identifier of the application which calls this method.
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError in any other error case.
Code example:
var myCustomData = {
foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
app.broadcastEvent({"name": "custom_user_event"}, myCustomData);
broadcastTrustedEvent
void broadcastTrustedEvent(EventInfo event, UserEventData data);
Since: 2.4
An application can listen to events from other applications. However, it can only broadcast its own events. Therefore, the appId attribute of the EventInfo dictionary must be the identifier of the application which calls this method.
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError in any other error case.
Code example:
var myTrustedCustomData = {
foo: 'bar'
};
var app = tizen.application.getCurrentApplication();
app.broadcastTrustedEvent({"name": "custom_user_event"}, myTrustedCustomData);
[NoInterfaceObject] interface ApplicationInformation {
readonly attribute ApplicationId id;
readonly attribute DOMString name;
readonly attribute DOMString iconPath;
readonly attribute DOMString version;
readonly attribute boolean show;
readonly attribute DOMString[] categories;
readonly attribute Date installDate;
readonly attribute long size raises(WebAPIException);
readonly attribute PackageId packageId;
};
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
Privilege level: public
Privilege: http://tizen.org/privilege/application.info
Exceptions:
with error type SecurityError, if this attribute is not allowed.
Since: 2.4
[NoInterfaceObject] interface ApplicationContext {
readonly attribute ApplicationContextId id;
readonly attribute ApplicationId appId;
};
Since: 2.4
Since: 2.4
Since: 2.4
[NoInterfaceObject] interface ApplicationBatteryUsage {
readonly attribute ApplicationId appId;
readonly attribute double batteryUsage;
};
Since: 4.0
Since: 4.0
Since: 4.0
[NoInterfaceObject] interface ApplicationUsage {
readonly attribute ApplicationId appId;
readonly attribute unsigned long totalCount;
readonly attribute unsigned long totalDuration;
readonly attribute Date lastTime;
};
Since: 4.0
Since: 4.0
Since: 4.0
Since: 4.0
Since: 4.0
[Constructor(DOMString key, DOMString[] value)]
interface ApplicationControlData {
attribute DOMString key;
attribute DOMString[] value;
};
Since: 2.4
Code example:
var appControlData = new tizen.ApplicationControlData("image", [imagedata1]);
ApplicationControlData(DOMString key, DOMString[] value);
Since: 2.4
Since: 2.4
[Constructor(DOMString operation, optional DOMString? uri,
optional DOMString? mime, optional DOMString? category,
optional ApplicationControlData[]? data, optional ApplicationControlLaunchMode? launchMode)]
interface ApplicationControl {
attribute DOMString operation;
attribute DOMString? uri;
attribute DOMString? mime;
attribute DOMString? category;
attribute ApplicationControlData[] data;
attribute ApplicationControlLaunchMode launchMode;
};
Since: 2.4
Code example:
var appControl =
new tizen.ApplicationControl(
"http://tizen.org/appcontrol/operation/view",
null,
"image/jpeg",
null,
[new tizen.ApplicationControlData("images",
[imagedata1, imagedata2])] );
ApplicationControl(DOMString operation, optional DOMString? uri, optional DOMString? mime, optional DOMString? category, optional ApplicationControlData[]? data, optional ApplicationControlLaunchMode? launchMode);
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
Since: 2.4
[NoInterfaceObject] interface RequestedApplicationControl {
readonly attribute ApplicationControl appControl;
readonly attribute ApplicationId callerAppId;
void replyResult(optional ApplicationControlData[]? data) raises(WebAPIException);
void replyFailure() raises(WebAPIException);
};
Since: 2.4
Since: 2.4
Since: 2.4
replyResult
void replyResult(optional ApplicationControlData[]? data);
Since: 2.4
Parameters:
Exceptions:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type NotFoundError, if the caller app is not alive or there is no response from the caller app.
with error type UnknownError, if the reply request fails because of an unknown error.
Code example:
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]);
}
}
replyFailure
void replyFailure();
Since: 2.4
Exceptions:
with error type NotFoundError, if the caller app is not alive or there is no response from the caller app.
with error type UnknownError, if the reply request fails because of an unknown error.
Code example:
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") {
reqAppControl.replyFailure();
}
}
[NoInterfaceObject] interface ApplicationCertificate {
readonly attribute DOMString type;
readonly attribute DOMString value;
};
Since: 2.4
Since: 2.4
Since: 2.4
[NoInterfaceObject] interface ApplicationMetaData {
readonly attribute DOMString key;
readonly attribute DOMString value;
};
Since: 2.4
Since: 2.4
Since: 2.4
[Callback=FunctionOnly, NoInterfaceObject] interface BatteryUsageInfoArraySuccessCallback {
void onsuccess(ApplicationBatteryUsage[] batteryInfoArray);
};
Since: 4.0
This callback interface specifies a success method with an array of ApplicationBatteryUsage objects as an input parameter. It is used in ApplicationManager.getBatteryUsageInfo() method.
onsuccess
void onsuccess(ApplicationBatteryUsage[] batteryInfoArray);
Since: 4.0
Remark : Example of usage can be find at getBatteryUsageInfo code example.
Parameters:
[Callback=FunctionOnly, NoInterfaceObject] interface AppsUsageInfoArraySuccessCallback {
void onsuccess(ApplicationUsage[] appsInfoArray);
};
Since: 4.0
This callback interface specifies a success method with an array of ApplicationUsage objects as an input parameter. It is used in ApplicationManager.getAppsUsageInfo() method.
onsuccess
void onsuccess(ApplicationUsage[] appsInfoArray);
Since: 4.0
Remark : An example of usage can be find at getAppsUsageInfo code example.
Parameters:
[Callback=FunctionOnly, NoInterfaceObject] interface ApplicationInformationArraySuccessCallback {
void onsuccess(ApplicationInformation[] informationArray);
};
Since: 2.4
This callback interface specifies a success method with an array of ApplicationInformation objects as an input parameter. It is used in ApplicationManager.getAppsInfo().
onsuccess
void onsuccess(ApplicationInformation[] informationArray);
Since: 2.4
Parameters:
Code example:
function onListInstalledApps(applications) {
for (var i = 0; i < applications.length; i++)
console.log("ID : " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
[Callback=FunctionOnly, NoInterfaceObject] interface FindAppControlSuccessCallback {
void onsuccess(ApplicationInformation[] informationArray, ApplicationControl appControl);
};
Since: 2.4
This callback interface specifies a success method with an array of ApplicationInformation objects and application control as an input parameter. It is used in ApplicationManager.findAppControl().
onsuccess
void onsuccess(ApplicationInformation[] informationArray, ApplicationControl appControl);
Since: 2.4
Parameters:
Code example:
var appControl = new tizen.ApplicationControl(
"http://tizen.org/appcontrol/operation/pick",
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 );
}
tizen.application.findAppControl(appControl, successCB);
[Callback=FunctionOnly, NoInterfaceObject] interface ApplicationContextArraySuccessCallback {
void onsuccess(ApplicationContext[] contexts);
};
Since: 2.4
This callback interface specifies a success method with an array of ApplicationContext objects as an input parameter. It is used in ApplicationManager.getAppsContext().
onsuccess
void onsuccess(ApplicationContext[] contexts);
Since: 2.4
Parameters:
[Callback, NoInterfaceObject] interface ApplicationControlDataArrayReplyCallback {
void onsuccess(optional ApplicationControlData[]? data);
void onfailure();
};
Since: 2.4
This callback interface specifies two methods:
Code example:
var appControl = new tizen.ApplicationControl(
"http://tizen.org/appcontrol/operation/pick",
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');
}
}
tizen.application.launchAppControl(
appControl,
null,
function() {console.log("launch application control succeed"); },
function(e) {console.log("launch application control failed. reason: " + e.message); },
appControlReplyCallback );
onsuccess
void onsuccess(optional ApplicationControlData[]? data);
Since: 2.4
Parameters:
onfailure
void onfailure();
Since: 2.4
[Callback, NoInterfaceObject] interface ApplicationInformationEventCallback {
void oninstalled(ApplicationInformation info);
void onupdated(ApplicationInformation info);
void onuninstalled(ApplicationId id);
};
Since: 2.4
This callback interface specifies methods that are invoked when 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');
}
};
var watchId = tizen.application.addAppInfoEventListener(appEventCallback);
oninstalled
void oninstalled(ApplicationInformation info);
Since: 2.4
Parameters:
onupdated
void onupdated(ApplicationInformation info);
Since: 2.4
Parameters:
onuninstalled
void onuninstalled(ApplicationId id);
Since: 2.4
Parameters:
[NoInterfaceObject] interface SystemEventData {
attribute DOMString value;
attribute DOMString type;
};
Since: 2.4
Platform modules will be able to broadcast system events in a future Tizen release.
[Callback=FunctionOnly, NoInterfaceObject] interface EventCallback {
void onevent(EventInfo event, EventData data);
};
Since: 2.4
onevent
Since: 2.4
Parameters:
Code example:
var app = tizen.application.getCurrentApplication();
// for user events: sender's application ID and event name must be provided by using a dictionary
// 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);
}
}
tizen.application.getAppsInfo(onListInstalledApps);
[Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback {
void onchange(ApplicationId appId, boolean isActive);
};
Since: 4.0
onchange
void onchange(ApplicationId appId, boolean isActive);
Since: 4.0
Example of using can be find at addAppStatusChangeListener code example.
Parameters:
dictionary EventInfo {
ApplicationId appId;
DOMString name;
};
Since: 2.4
System events do not require an application identifier to be specified. If one is specified, the event will be interpreted as an user event.
An application can listen to events from other applications. However, it can only broadcast its own events. Therefore, when broadcasting an event, this dictionary member must be the identifier of the application which is broadcasting the event.
System events do not require an application identifier to be specified. If one is specified, the event will be interpreted as an user event.
Since: 2.4
Must only contain the ASCII characters "[A-Z][a-z][0-9]_" and may not begin with a digit. Must be at least 1 byte in length and not exceed the maximum name length of 127 bytes.
Since: 2.4
To guarantee the running of the application on a device which has battery, declare the following feature requirement in the config file:
For more information, see Application Filtering.
module Application {
typedef DOMString ApplicationId;
typedef DOMString ApplicationContextId;
typedef object UserEventData;
typedef (SystemEventData or UserEventData) EventData;
enum ApplicationControlLaunchMode { "SINGLE", "GROUP" };
enum ApplicationUsageMode { "RECENTLY", "FREQUENTLY" };
[NoInterfaceObject] interface ApplicationManagerObject {
readonly attribute ApplicationManager application;
};
Tizen implements ApplicationManagerObject;
[NoInterfaceObject] interface ApplicationManager {
Application getCurrentApplication() raises(WebAPIException);
void kill(ApplicationContextId contextId,
optional SuccessCallback? successCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
void launch(ApplicationId id,
optional SuccessCallback? successCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
void launchAppControl(ApplicationControl appControl,
optional ApplicationId? id,
optional SuccessCallback? successCallback,
optional ErrorCallback? errorCallback,
optional ApplicationControlDataArrayReplyCallback? replyCallback) raises(WebAPIException);
void findAppControl(ApplicationControl appControl,
FindAppControlSuccessCallback successCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
void getAppsContext(ApplicationContextArraySuccessCallback successCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
ApplicationContext getAppContext(optional ApplicationContextId? contextId) raises(WebAPIException);
void getAppsInfo(ApplicationInformationArraySuccessCallback successCallback,
optional ErrorCallback? errorCallback) raises(WebAPIException);
ApplicationInformation getAppInfo(optional ApplicationId? id) raises(WebAPIException);
ApplicationCertificate[] getAppCerts(optional ApplicationId? id) raises(WebAPIException);
DOMString getAppSharedURI(optional ApplicationId? id) raises(WebAPIException);
ApplicationMetaData[] getAppMetaData(optional ApplicationId? id) raises(WebAPIException);
void getBatteryUsageInfo(BatteryUsageInfoArraySuccessCallback successCallback,
optional ErrorCallback? errorCallback,
optional long? days,
optional long? limit) raises(WebAPIException);
void getAppsUsageInfo(AppsUsageInfoArraySuccessCallback successCallback,
optional ErrorCallback? errorCallback,
optional ApplicationUsageMode? mode,
optional ApplicationUsageFilter? filter,
optional long? limit) raises(WebAPIException);
long addAppStatusChangeListener(StatusEventCallback eventCallback, optional ApplicationId? appId) raises(WebAPIException);
void removeAppStatusChangeListener(long watchId) raises(WebAPIException);
};
dictionary ApplicationUsageFilter {
long? timeSpan;
Date? startTime;
Date? endTime;
};
[NoInterfaceObject] interface Application {
readonly attribute ApplicationInformation appInfo;
readonly attribute ApplicationContextId contextId;
void exit() raises(WebAPIException);
void hide() raises(WebAPIException);
RequestedApplicationControl getRequestedAppControl() raises(WebAPIException);
long addEventListener(EventInfo event, EventCallback callback) raises(WebAPIException);
void removeEventListener(long watchId) raises(WebAPIException);
void broadcastEvent(EventInfo event, UserEventData data) raises(WebAPIException);
void broadcastTrustedEvent(EventInfo event, UserEventData data) raises(WebAPIException);
};
[NoInterfaceObject] interface ApplicationInformation {
readonly attribute ApplicationId id;
readonly attribute DOMString name;
readonly attribute DOMString iconPath;
readonly attribute DOMString version;
readonly attribute boolean show;
readonly attribute DOMString[] categories;
readonly attribute Date installDate;
readonly attribute long size raises(WebAPIException);
readonly attribute PackageId packageId;
};
[NoInterfaceObject] interface ApplicationContext {
readonly attribute ApplicationContextId id;
readonly attribute ApplicationId appId;
};
[NoInterfaceObject] interface ApplicationBatteryUsage {
readonly attribute ApplicationId appId;
readonly attribute double batteryUsage;
};
[NoInterfaceObject] interface ApplicationUsage {
readonly attribute ApplicationId appId;
readonly attribute unsigned long totalCount;
readonly attribute unsigned long totalDuration;
readonly attribute Date lastTime;
};
[Constructor(DOMString key, DOMString[] value)]
interface ApplicationControlData {
attribute DOMString key;
attribute DOMString[] value;
};
[Constructor(DOMString operation, optional DOMString? uri,
optional DOMString? mime, optional DOMString? category,
optional ApplicationControlData[]? data, optional ApplicationControlLaunchMode? launchMode)]
interface ApplicationControl {
attribute DOMString operation;
attribute DOMString? uri;
attribute DOMString? mime;
attribute DOMString? category;
attribute ApplicationControlData[] data;
attribute ApplicationControlLaunchMode launchMode;
};
[NoInterfaceObject] interface RequestedApplicationControl {
readonly attribute ApplicationControl appControl;
readonly attribute ApplicationId callerAppId;
void replyResult(optional ApplicationControlData[]? data) raises(WebAPIException);
void replyFailure() raises(WebAPIException);
};
[NoInterfaceObject] interface ApplicationCertificate {
readonly attribute DOMString type;
readonly attribute DOMString value;
};
[NoInterfaceObject] interface ApplicationMetaData {
readonly attribute DOMString key;
readonly attribute DOMString value;
};
[Callback=FunctionOnly, NoInterfaceObject] interface BatteryUsageInfoArraySuccessCallback {
void onsuccess(ApplicationBatteryUsage[] batteryInfoArray);
};
[Callback=FunctionOnly, NoInterfaceObject] interface AppsUsageInfoArraySuccessCallback {
void onsuccess(ApplicationUsage[] appsInfoArray);
};
[Callback=FunctionOnly, NoInterfaceObject] interface ApplicationInformationArraySuccessCallback {
void onsuccess(ApplicationInformation[] informationArray);
};
[Callback=FunctionOnly, NoInterfaceObject] interface FindAppControlSuccessCallback {
void onsuccess(ApplicationInformation[] informationArray, ApplicationControl appControl);
};
[Callback=FunctionOnly, NoInterfaceObject] interface ApplicationContextArraySuccessCallback {
void onsuccess(ApplicationContext[] contexts);
};
[Callback, NoInterfaceObject] interface ApplicationControlDataArrayReplyCallback {
void onsuccess(optional ApplicationControlData[]? data);
void onfailure();
};
[Callback, NoInterfaceObject] interface ApplicationInformationEventCallback {
void oninstalled(ApplicationInformation info);
void onupdated(ApplicationInformation info);
void onuninstalled(ApplicationId id);
};
[NoInterfaceObject] interface SystemEventData {
attribute DOMString value;
attribute DOMString type;
};
[Callback=FunctionOnly, NoInterfaceObject] interface EventCallback {
void onevent(EventInfo event, EventData data);
};
[Callback=FunctionOnly, NoInterfaceObject] interface StatusEventCallback {
void onchange(ApplicationId appId, boolean isActive);
};
dictionary EventInfo {
ApplicationId appId;
DOMString name;
};
};