This Application API provides a way to access application management.
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.
typedef (SystemEventData or UserEventData) EventData;
Since: 2.4
1.5. ApplicationControlLaunchMode
Specifies the application launch mode when it is launched by launchAppControl(). This value may be overriden if application launched by launchAppControl() has value SINGLE configured in application manifest.
The ErrorCallback method is launched with these error types:
NotFoundError - If the context is not found with the specified context ID.
InvalidValuesError - If any of the input parameters contain an invalid value or if the specified context ID matches the context ID of the calling application.
contextId: The identifier of the application to kill
successCallback optionalnullable: The method to invoke when an application is killed successfully
errorCallback optionalnullable: The method to invoke when an error occurs
Exceptions:
WebAPIException
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);
findAppControl
Finds which applications can be launched with the given application control.
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:
NotFoundError - If the application is not found with the given Appcontrol.
UnknownError - If any other error occurs.
Parameters:
appControl: A data structure describing application control details
successCallback: The method to call that returns a list of application information
errorCallback optionalnullable: The method to call when an error occurs
Exceptions:
WebAPIException
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
Gets a list of application contexts for applications that are currently running on a device. The information contained for each application corresponds to the application state at the time when the list had been generated.
The ErrorCallback method is launched with this error type:
UnknownError - If an unknown error occurs.
Parameters:
successCallback: The method to call when the invocation ends successfully
errorCallback optionalnullable: The method to call when an error occurs
Exceptions:
WebAPIException
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
Gets the application context for the specified application context ID. If the ID is set to null or is not set at all, the method returns the application context of the current application. The list of running applications and their application IDs is obtained with getAppsContext().
contextId optionalnullable: A string representing an application context ID
If the ID is not provided, the application context of the calling application is returned.
Return value:
ApplicationContext A data structure that lists running application details.
Exceptions:
WebAPIException
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
Gets the list of installed applications' information on a device. The information contained on each application corresponds to the application state at the time when the list had been generated.
The ErrorCallback method is launched with this error type:
UnknownError - If an unknown error occurs.
Parameters:
successCallback: The method to call when the invocation ends successfully
errorCallback optionalnullable: The method to call when an error occurs
Exceptions:
WebAPIException
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
Gets application information for a specified application ID.
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:
id optionalnullable: A string representing an application ID
If the ID is not provided, the application information of the calling application is returned.
Return value:
ApplicationInformation The information of an application.
Exceptions:
WebAPIException
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
Gets application certificates for a specified application ID.
id optionalnullable: A string representing an application ID. If the ID is not provided, the application certificate of the calling application is returned.
Return value:
ApplicationCertificate[] Array of certificate information of a specified application
Exceptions:
WebAPIException
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);
}
getAppSharedURI
Gets the URI of the read-only shared directory of an application for a specified application ID.
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:
id optionalnullable: A string representing an application ID. If the ID is not provided, the shared directory URI of the calling application is returned.
Return value:
DOMString The shared directory URI of an application
Exceptions:
WebAPIException
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
Gets the application meta data array for a specified application ID.
id optionalnullable: A string representing an application ID. If the ID is not provided, the application metadata array of the calling application is returned.
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 returned
Exceptions:
WebAPIException
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
Gets information about battery usage per application.
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:
AbortError - if any system error occurred.
InvalidValuesError - if any of the input parameters contains an invalid value.
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:
successCallback: The method to call when the invocation ends successfully.
errorCallback optionalnullable: The method to call when an error occurs.
days optionalnullable: Number of days. If parameter was not given, method will behave as described above.
limit optionalnullable: This parameter defines maximum number of ApplicationBatteryUsage objects in an array in successCallback callback. By default, it is set to 30.
Exceptions:
WebAPIException
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.
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:
AbortError - if any system error occurred.
InvalidValuesError - if any of the input parameters contains an invalid value.
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:
successCallback: The method to call when the invocation ends successfully.
errorCallback optionalnullable: The method to call when an error occurs.
mode optionalnullable: The parameter defines a type of application usage to acquire. By default, it is set to FREQUENTLY.
filter optionalnullable: The filter for selecting period of time, from which data is accumulated. By default, this parameter has attribute timeSpan set to 30 days.
limit optionalnullable: This parameter defines maximum count of objects ApplicationUsage in returned array. By default, it is set to 10.
Exceptions:
WebAPIException
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.
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
Adds a listener for receiving any notification for changes in the list of installed applications on a device.
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.0
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:
eventCallback: The method to call when a change on the installed applications is made
Return value:
long ID of the listener that can be used to remove the listener later.
Exceptions:
WebAPIException
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
Removes the listener to stop receiving notifications for changes on the list of installed applications on a device.
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
Adds a listener for receiving any notification for status changes of the installed applications on a device.
long addAppStatusChangeListener(StatusEventCallback eventCallback, optional ApplicationId? appId);
Since: 4.0
Parameters:
eventCallback: The method to call when status of the installed applications is changed.
appId optionalnullable: The id of the application which status changes should be monitored. If the application id is ommitted or it is equal to null, all applications status changes will be monitored.
Return value:
long Listener id that can be used to remove the listener later.
Exceptions:
WebAPIException
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
Removes the listener to stop receiving notifications for status changes of the installed applications on a device.
void removeAppStatusChangeListener(long watchId);
Since: 4.0
Parameters:
watchId: An ID that identifies the listener.
Exceptions:
WebAPIException
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
2.3. ApplicationUsageFilter
This interface represents filter for defining period of time, which will be used as a condition in getAppsUsageInfo method.
The attribute to store period of time, from which data is accumulated, in days. The period of time begins timeSpan days ago and ends with current date.
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
Date? startTime
The attribute to store the date, which is used as a lower bound for selecting data.
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
Date? endTime
The attribute to store the date, which is used as an upper bound for selecting data.
If only endTime attribute is given, data will be accumulated from 90 days ago to endTime date.
Since: 4.0
2.4. Application
This interface defines the current application's information and the basic operations (such as exit or hide) for the current application.
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 control
Exceptions:
WebAPIException
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
Adds a listener which will invoke a callback function when an event occurs.
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:
event: Event which will invoke the callback
callback: Callback function to be invoked when the event occurs
Return value:
long Listener identifier
Exceptions:
WebAPIException
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
Removes an event listener with a specified listener identifier.
void removeEventListener(long watchId);
Since: 2.4
Parameters:
watchId: Listener identifier
Exceptions:
WebAPIException
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
Broadcasts a user defined event to all the listeners which are listening for this event.
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:
event: Event to broadcast
data: User defined event data to broadcast
Exceptions:
WebAPIException
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
Broadcasts a user defined event to all the trusted listeners which are listening for this event. Applications which have the same certificate as the sending application can receive the event.
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:
event: Trusted event to broadcast
data: User defined trusted event data to broadcast
Exceptions:
WebAPIException
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);
2.5. ApplicationInformation
This interface defines the general information available to an installed application.
An attribute to store the application size (installed space).
Since: 2.0
Privilege level: public
Privilege: http://tizen.org/privilege/application.info
Exceptions:
* WebAPIException
* with error type SecurityError, if this attribute is not allowed.
An attribute which stores information about battery usage of an application with ApplicationId _appId_. Battery usage is a ratio of battery consumption of the application with ApplicationId _appId_ to the total battery consumption of all applications. The attribute value scales from 0 to 1, the higher value, the more battery is consumed. Since: 4.0
2.8. ApplicationUsage
This interface defines information about usage of application.
[NoInterfaceObject] interface ApplicationUsage {
readonly attribute ApplicationId appId;
readonly attribute unsigned long totalCount;
readonly attribute unsigned long totalDuration;
readonly attribute Date lastTime;
};
An attribute to store the value associated with a key. Since: 2.0
2.10. ApplicationControl
This interface consists of an operation, URI, MIME type, and data. It describes an action to be performed by other applications and is passed to launch other applications. If the system gets the application control request, it finds the corresponding application to be launched with the delivered application control and launches the selected application.
An attribute to specify launch mode. Default application launch mode is _SINGLE_. Since: 2.4
2.11. RequestedApplicationControl
This interface has an application control information requested and passed from another application and is passed to launch other applications. The newly launched application can get the requested application control through the getRequestedAppControl() method, and send the results to the calling application through the replyResult() method after performing the required action requested by the calling application.
An attribute to store the application control object that describes the caller application's request. It contains the information that the calling application passed to _launchAppControl_.
Since: 2.0
data optionalnullable: An array of ApplicationControlData objects
Exceptions:
WebAPIException
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
Notifies the calling application that the application failed to perform the requested action.
void replyFailure();
Since: 2.0
Exceptions:
WebAPIException
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();
}
}
2.12. ApplicationCertificate
This interface defines the certificate information of an installed application.
This callback interface specifies a success method with an array of ApplicationBatteryUsage objects as an input parameter. It is used in ApplicationManager.getBatteryUsageInfo() method.
Methods
onsuccess
Called when the asynchronous call completes successfully.
This callback interface specifies a success method with an array of ApplicationUsage objects as an input parameter. It is used in ApplicationManager.getAppsUsageInfo() method.
Methods
onsuccess
Called when the asynchronous call completes successfully.
void onsuccess(ApplicationUsage[] appsInfoArray);
Since: 4.0
Remark : An example of usage can be find at getAppsUsageInfo code example.
Parameters:
appsInfoArray: An array of data containing information about usage per application.
2.16. ApplicationInformationArraySuccessCallback
This callback interface specifies a success callback that is invoked when the installed application list is retrieved.
This callback interface specifies a success method with an array of ApplicationInformation objects as an input parameter. It is used in ApplicationManager.getAppsInfo().
Methods
onsuccess
Called when the asynchronous call completes successfully.
informationArray: A list of installed applications
Code example:
function onListInstalledApps(applications) {
for (var i = 0; i < applications.length; i++)
console.log("ID : " + applications[i].id);
}
tizen.application.getAppsInfo(onListInstalledApps);
2.17. FindAppControlSuccessCallback
This callback interface specifies a success callback that is invoked when the system has finished searching applications that match a specific application control .
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().
Methods
onsuccess
Called when the asynchronous call completes successfully.
informationArray: A list of installed applications
appControl: The application control that is passed to ApplicationManager.findAppControl()
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);
2.18. ApplicationContextArraySuccessCallback
This callback interface specifies a success callback that is invoked when the list of running applications is retrieved.
This callback interface specifies a success method with an array of ApplicationContext objects as an input parameter. It is used in ApplicationManager.getAppsContext().
Methods
onsuccess
Called when _ApplicationManager.getAppsContext()_ completes successfully.
void onsuccess(ApplicationContext[] contexts);
Since: 1.0
Parameters:
contexts: A list of running applications
2.19. ApplicationControlDataArrayReplyCallback
The ApplicationControlDataArrayReplyCallback callback specifies success callbacks that are invoked as a reply from the requested application control within the application control requester.
data optionalnullable: An array of ApplicationControlData objects
onfailure
Called when the callee application calls RequestedApplicationControl.replyFailure().
void onfailure();
Since: 2.0
2.16. ApplicationInformationEventCallback
The ApplicationInformationEventCallback specifies listener for subscribing for notifications of changes in the list of installed applications on a device.
event: Broadcasted event which invokes this callback
data: Broadcasted event data
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);
2.22. StatusEventCallback
The StatusEventCallback interface specifies a callback for getting notified when status of the installed application has been changed.
appId: Id of the application that status has been changed.
isActive: The new status of the application.
2.23. 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.
The unique identifier of the application which is broadcasting an 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
DOMString name
Name which describes the event.
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
3. Related Feature
You can check if this API is supported with tizen.systeminfo.getCapability() and decide enable/disable codes that need this API.
To guarantee the running of the application on a device which has battery, declare the following feature requirement in the config file:
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.