Samsung Electronics logo

Samsung Web API: Application


Introduction

This API provides a way to launch other applications and access application management.

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 current application such as exit or hide.

For more information on the Application features, see Application Guide.


Table of Contents


Summary of Interfaces and Methods

Interface Method
ApplicationManagerObject
ApplicationManager Application getCurrentApplication()
void launch(ApplicationId id, SuccessCallback? successCallback, ErrorCallback? errorCallback)
void launchAppControl(ApplicationControl appControl, ApplicationId? id, SuccessCallback? successCallback, ErrorCallback? errorCallback, ApplicationControlDataArrayReplyCallback? replyCallback)
void findAppControl(ApplicationControl appControl, FindAppControlSuccessCallback successCallback, ErrorCallback? errorCallback)
void getAppsContext(ApplicationContextArraySuccessCallback successCallback, ErrorCallback? errorCallback)
ApplicationContext getAppContext(ApplicationContextId? contextId)
void getAppsInfo(ApplicationInformationArraySuccessCallback successCallback, ErrorCallback? errorCallback)
ApplicationInformation getAppInfo(ApplicationId? id)
DOMString getAppSharedURI(ApplicationId? id)
ApplicationMetaData[] getAppMetaData(ApplicationId? id)
long addAppInfoEventListener(ApplicationInformationEventCallback eventCallback)
void removeAppInfoEventListener(long watchId)
Application void exit()
void hide()
RequestedApplicationControl getRequestedAppControl()
ApplicationInformation
ApplicationContext
ApplicationControlData
ApplicationControl
RequestedApplicationControl void replyResult(ApplicationControlData[]? data)
void replyFailure()
ApplicationMetaData
ApplicationInformationArraySuccessCallback void onsuccess(ApplicationInformation[] informationArray)
FindAppControlSuccessCallback void onsuccess(ApplicationInformation[] informationArray, ApplicationControl appControl)
ApplicationContextArraySuccessCallback void onsuccess(ApplicationContext[] contexts)
ApplicationControlDataArrayReplyCallback void onsuccess(ApplicationControlData[]? data)
void onfailure()
ApplicationInformationEventCallback void oninstalled(ApplicationInformation info)
void onupdated(ApplicationInformation info)
void onuninstalled(ApplicationId id)

1. Type Definitions

1.1. ApplicationId

The unique ID for an installed application.

  typedef DOMString ApplicationId;

1.2. ApplicationContextId

The unique ID for a running application.

  typedef DOMString ApplicationContextId;

2. Interfaces

2.1. ApplicationManagerObject

This interface defines what is instantiated by the WebAPIs object by the platform.

  [NoInterfaceObject] interface ApplicationManagerObject {
    readonly attribute ApplicationManager application;
  };
  WebAPIs implements ApplicationManagerObject;

There will be a webapis.application object that allows access to Application API functionality.

2.2. ApplicationManager

This section defines the application manager interface.

  [NoInterfaceObject] interface ApplicationManager {

    Application getCurrentApplication() 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);


    DOMString getAppSharedURI(optional ApplicationId? id) raises(WebAPIException);

     ApplicationMetaData[] getAppMetaData(optional ApplicationId? id) raises(WebAPIException);

    long addAppInfoEventListener(ApplicationInformationEventCallback eventCallback) raises(WebAPIException);

    void removeAppInfoEventListener(long watchId) raises(WebAPIException);

  };

METHODS

getCurrentApplication

Gets the Application object defining the current application.

Signature
Application getCurrentApplication();
Return value
Application The data structure that defines current application.
Exceptions
  • WebAPIException:

    with error type UnknownError, if the application cannot be retrieved because of an unknown error.

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

Code example
 var app = webapis.application.getCurrentApplication();
 console.log("Current application's app id is " + app.appInfo.id);
 

launch

Launches an application with the given application ID.

Signature
void launch(ApplicationId id, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);

The ErrorCallback() is launched with these error types:

  • NotFoundError - If the application is not found with given ID.
  • InvalidValuesError - If any of the input parameters contain an invalid value.
  • UnknownError - If any other error occurs.
Parameters
  • id
    • Optional: No.
    • Nullable: No.
    • Type: ApplicationId.
    • Description: A unique string representing application ID.
  • successCallback
    • Optional: Yes.
    • Nullable: Yes.
    • Type: SuccessCallback.
    • Description: The method to call when the invocation ends successfully.
  • errorCallback
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ErrorCallback.
    • Description: The method to call when an error occurs.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

    with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

Code example
 function onsuccess() {
     console.log("The application has launched successfully");
 }

 // let's assume that application "targetApp0.main" has been installed
 webapis.application.launch("targetApp0.main", onsuccess);
 

launchAppControl

Launches an application with the specified application control.

Signature
void launchAppControl(ApplicationControl appControl, optional ApplicationId? id, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback, optional ApplicationControlDataArrayReplyCallback? replyCallback);

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 getRequestedAppControl() method. The passed application control contains the reason the application was 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 RequestedApplicationControl interface.

The ErrorCallback() is launched with these error types:

  • NotFoundError - If system cannot find the application that matches the specified application control.
  • InvalidValuesError - If any of the input parameters contain an invalid value.
  • UnknownError: If any other error occurs.
Parameters
  • appControl
    • Optional: No.
    • Nullable: No.
    • Type: ApplicationControl.
    • Description: The data structure describing application control details.
  • id
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ApplicationId.
    • Description: An identifier of the application to be launched. If the ID is null or not specified, then the system tries to find the application to be launched for the requested application control.
  • successCallback
    • Optional: Yes.
    • Nullable: Yes.
    • Type: SuccessCallback.
    • Description: The method to call when the invocation ends successfully.
  • errorCallback
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ErrorCallback.
    • Description: The method to invoke when an error occurs.
  • replyCallback
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ApplicationControlDataArrayReplyCallback.
    • Description: The method to invoke when the application gets back results from the launched application.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

    with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

Code example
 var appControl = new webapis.ApplicationControl(
     "http://samsungapps.com/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://samsungapps.com/appcontrol/data/selected") {
                 console.log('Selected image is ' + data[i].value[0]);
             }
         }
     },
     // callee returned failure
     onfailure: function() {
         console.log('The launch application control failed');
     }
 }

 webapis.application.launchAppControl(
     appControl,
     null,
     function() {console.log("launch application control succeed"); },
     function(e) {console.log("launch application control failed. reason: " + e.message); },
     appControlReplyCallback );
 

findAppControl

Finds application information can be launched with the given application control.

Signature
void findAppControl(ApplicationControl appControl, FindAppControlSuccessCallback successCallback, optional ErrorCallback? errorCallback);

An application can get a list of other applications can be launched with the application control.

The ErrorCallback() is launched with these error types:

  • InvalidValuesError - If any of the input parameters contain an invalid value.
  • UnknownError - If any other error occurs.
Parameters
  • appControl
    • Optional: No.
    • Nullable: No.
    • Type: ApplicationControl.
    • Description: A data structure describing application control details.
  • successCallback
    • Optional: No.
    • Nullable: No.
    • Type: FindAppControlSuccessCallback.
    • Description: The method to call that returns a list of application information.
  • errorCallback
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ErrorCallback.
    • Description: The method to call when an error occurs.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

    with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

Code example
 var appControl = new webapis.ApplicationControl(
     "http://samsungapps.com/appcontrol/operation/pick",
     null,
     "image/jpeg",
     null);

 function successCB(appInfos, appControl)
 {
     // em>appControl/em> is same object with the value passed as first parameter to em>findAppControl()/em>
     var appControlReplyCallback = {
         // callee sent a reply
         onsuccess: function(data) {
             for (var i = 0; i < data.length; i++) {
                 if (data[i].key == "http://samsungapps.com/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

     webapis.application.launchAppControl(
         appControl, 
         appId,
         function() {console.log("launch application control succeed"); },
        function(e) {console.log("launch application control failed. reason: " + e.message); },
        appControlReplyCallback );
 }

 webapis.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 was generated.

Signature
void getAppsContext(ApplicationContextArraySuccessCallback successCallback, optional ErrorCallback? errorCallback);

The errorCallback() is launched with this error type:

  • UnknownError - If an unknown error occurs.
Parameters
  • successCallback
    • Optional: No.
    • Nullable: No.
    • Type: ApplicationContextArraySuccessCallback.
    • Description: The method to call when the invocation ends successfully.
  • errorCallback
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ErrorCallback.
    • Description: The method to call when an error occurs.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

    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);
 }

 webapis.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().

Signature
ApplicationContext getAppContext(optional ApplicationContextId? contextId);
Parameters
  • contextId
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ApplicationContextId.
    • Description: A string representing an application context ID. If the ID is not provided, the application context of the calling application will be returned.
Return value
ApplicationContext A data structure that lists running application details.
Exceptions
  • WebAPIException:

    with error type UnknownError, if the application context cannot be retrieved because of an unknown error.

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

    with error type NotFoundError, if the application context is not found with provided ID.

    with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

Code example
 var appContext = webapis.application.getAppContext(null);
 console.log("Application context retrieved for app " + appContext.appId);
 

getAppsInfo

Gets the list of installed application's information on a device. The information contained on each application corresponds to the application state at the moment when the list was generated.

Signature
void getAppsInfo(ApplicationInformationArraySuccessCallback successCallback, optional ErrorCallback? errorCallback);

The errorCallback() is launched with this error type:

  • UnknownError - If an unknown error occurs.
Parameters
  • successCallback
    • Optional: No.
    • Nullable: No.
    • Type: ApplicationInformationArraySuccessCallback.
    • Description: The method to call when the invocation ends successfully.
  • errorCallback
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ErrorCallback.
    • Description: The method to call when an error occurs.
Exceptions
  • WebAPIException:

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

    with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

Code example
 var appContext = webapis.application.getAppContext(null);
 console.log("Application context retrieved for app " + appContext.appId);
      

getAppInfo

Gets application information for a specified application ID.

Signature
ApplicationInformation getAppInfo(optional ApplicationId? 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
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ApplicationId.
    • Description: A string representing application ID. If the ID is not provided, the application information of the calling application will be returned.
Return value
ApplicationInformation The information of an application.
Exceptions
  • WebAPIException:

    with error type UnknownError, if the application cannot be retrieved because of an unknown error.

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

    with error type NotFoundError, if the application is not found with specified ID.

    with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

Code example
 var appInfo = webapis.application.getAppInfo(null);
 console.log("Current application name : " + appInfo.name);
 

getAppSharedURI
Signature
DOMString getAppSharedURI(optional ApplicationId? id);
Parameters
  • id
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ApplicationId.
    • Description:
Exceptions
  • WebAPIException:

getAppMetaData
Signature
ApplicationMetaData[] getAppMetaData(optional ApplicationId? id);
Parameters
  • id
    • Optional: Yes.
    • Nullable: Yes.
    • Type: ApplicationId.
    • Description:
Exceptions
  • WebAPIException:

addAppInfoEventListener

Adds a listener for receiving any notification for changes in the list of the installed applications on a device.

Signature
long addAppInfoEventListener(ApplicationInformationEventCallback eventCallback);

It install a callback that is triggered every time a change occurs on the list of installed applications on a device. This change may be occurred by 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
    • Optional: No.
    • Nullable: No.
    • Type: ApplicationInformationEventCallback.
    • Description: 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 UnknownError, if fails to add listener because of an unknown error.

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

    with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

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 = webapis.application.addAppInfoEventListener(appEventCallback);
 

removeAppInfoEventListener

Removes the listener to stop receiving notifications for changes on the list of installed applications on a device.

Signature
void removeAppInfoEventListener(long watchId);
Parameters
  • watchId
    • Optional: No.
    • Nullable: No.
    • Type: long.
    • Description: An ID that identifies the listener.
Exceptions
  • WebAPIException:

    with error type UnknownError, if fails to remove listener because of an unknown error.

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

    with error type NotFoundError, if the listener is not found with specified ID.

    with error type InvalidValuesError, if any of the input parameters contain an invalid value.

    with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

Code example
 webapis.application.removeAppInfoEventListener(watchId);
 

2.3. Application

This interface defines the current application's information and the basic operations (such as exit or hide) for the current application .

  [NoInterfaceObject] interface Application {

    readonly attribute ApplicationInformation appInfo;

    readonly attribute ApplicationContextId contextId;

    void exit() raises(WebAPIException);

    void hide() raises(WebAPIException);

    RequestedApplicationControl getRequestedAppControl() raises(WebAPIException);
  };

ATTRIBUTES

readonly ApplicationInformation appInfo

An attribute to store the application information for the current application.

This attribute is read-only.

readonly ApplicationContextId contextId

An attribute to store the ID of a running application.

This attribute is read-only.

METHODS

exit

Exits the current application.

Signature
void exit();
Exceptions
  • WebAPIException:

    with error type UnknownError, if any other error occurs.

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

Code example
 var app = webapis.application.getCurrentApplication();

 app.exit();
 

hide

Hides the current application.

Signature
void hide();
Exceptions
  • WebAPIException:

    with error type UnknownError, if any other error occurs.

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

Code example
 var app = webapis.application.getCurrentApplication();

 app.hide();
      

getRequestedAppControl

Gets the requested application control passed to the current application.

Signature
RequestedApplicationControl getRequestedAppControl();

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 was launched and what it has to perform. For example, an application might be launched to display an image on a page by other 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.

Return value
RequestedApplicationControl The details of an requested application control
Exceptions
  • WebAPIException:

    with error type UnknownError, if the application control cannot be retrieved because of an unknown error.

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

Code example
 var reqAppControl = webapis.application.getCurrentApplication().getRequestedAppControl();

 if (reqAppControl) {
     console.log("Requester AppID : " + reqAppControl.callerAppId);
 }
 

2.4. ApplicationInformation

This interface defines the general information available to an installed application.

  [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;

  };

ATTRIBUTES

readonly ApplicationId id

An attribute to store the identifier of an application for application management.

This attribute is read-only.

readonly DOMString name

An attribute to store the name of an application.

This attribute is read-only.

readonly DOMString iconPath

An attribute to store the icon path of an application.

This attribute is read-only.

readonly DOMString version

An attribute to store the version of an application.

This attribute is read-only.

readonly boolean show

An attribute that determines whether the application information should be shown (such as in the menus) or not.

This attribute is read-only.

readonly DOMString[] categories

An array of attributes to store the categories that the app belongs to.

This attribute is read-only.

readonly Date installDate

An attribute to store the application install/update time.

This attribute is read-only.

readonly long size

An attribute to store the application size (installed space).

This attribute is read-only.

2.5. ApplicationContext

This interface defines the information available about a running application.

  [NoInterfaceObject] interface ApplicationContext {

    readonly attribute ApplicationContextId id;

    readonly attribute ApplicationId appId;

  };

ATTRIBUTES

readonly ApplicationContextId id

An attribute to store the ID of a running application.

This attribute is read-only.

readonly ApplicationId appId

An attribute to store the ID of an installed application.

This attribute is read-only.

2.6. ApplicationControlData

This interface defines a key/value pair used to pass data between applications through the ApplicationControl interface.

  [Constructor(DOMString key, DOMString[] value)]
  interface ApplicationControlData {

    attribute DOMString key;

    attribute DOMString[] value;

  };
Code example
 var appControlData = new webapis.ApplicationControlData("image", [imagedata1]);
 

ATTRIBUTES

DOMString key

An attribute to store the name of a key.

DOMString[] value

An attribute to store the value associated with a key.

2.7. 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.

  [Constructor(DOMString operation, optional DOMString? uri,
               optional DOMString? mime, optional DOMString? category,
               optional ApplicationControlData[]? data)]
  interface ApplicationControl {

    attribute DOMString operation;

    attribute DOMString? uri;

    attribute DOMString? mime;

    attribute DOMString? category;

    attribute ApplicationControlData[] data;

  };
Code example
 var appControl =
       new webapis.ApplicationControl(
                  "http://samsungapps.com/appcontrol/operation/view",
                  filePath,
                  "image/jpeg",
                  null,
                  [new webapis.ApplicationControlData("images",
                                                    [imagedata1, imagedata2])] );
 

ATTRIBUTES

DOMString operation

An attribute to store the string that defines the action to be performed by an application control. This is a platform specific value.

DOMString? uri

An attribute to store the URI needed by application control.

DOMString? mime

An attribute to store the MIME type of a content.

DOMString? category

An attribute to store the category of the application to be launched.

ApplicationControlData[] data

An array of attributes to store the data needed for an application control.

2.8. RequestedApplicationControl

This interface has an application control information requested and passed from other application and is passed to launch other applications. The newly launched application can get the requested application control through getRequestedAppControl() method, and send the results to the calling application through the replyResult() method after performing the required action requested the calling application.

  [NoInterfaceObject] interface RequestedApplicationControl {

    readonly attribute ApplicationControl appControl;

    readonly attribute ApplicationId callerAppId;

    void replyResult(optional ApplicationControlData[]? data) raises(WebAPIException);

    void replyFailure() raises(WebAPIException);

  };
Code example
 var reqAppControl = webapis.application.getCurrentApplication().getRequestedAppControl();
 if (reqAppControl) {
     console.log("Requester AppID : " + reqAppControl.callerAppId);

     var appControl = reqAppControl.appControl;
     if (appControl.operation == "http://samsungapps.com/appcontrol/operation/pick") {
         var data = new webapis.ApplicationControlData("http://samsungapps.com/appcontrol/data/selected", ["Image1.jpg"]);
         reqAppControl.replyResult([data]);
     }
 }
 

ATTRIBUTES

readonly ApplicationControl appControl

An attribute to store the application control object that describes caller application's request. It contains the information that the calling application passed to launchAppControl.

This attribute is read-only.

readonly ApplicationId callerAppId

An attribute to store the caller application's ID

This attribute is read-only.

METHODS

replyResult

Sends the results to the caller application.

Signature
void replyResult(optional ApplicationControlData[]? data);
Parameters
  • data
    • Optional: Yes.
    • Nullable: Yes.
    • Type: array.
    • Description: An array of ApplicationControlData objects.
Exceptions
  • WebAPIException:

    with error type UnknownError, if the reply request fails because of an unknown error

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

    with error type NotFoundError, if the caller app is not alive or there is no response from the caller app

    with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

replyFailure

Notifies the calling application that the application failed to perform the requested action.

Signature
void replyFailure();
Exceptions
  • WebAPIException:

    with error type UnknownError, if the reply request fails because of an unknown error

    with error type NotSupportedError, if this feature is not supported.

    with error type SecurityError, if the functionality is not allowed.

    with error type NotFoundError, if the caller app is not alive or there is no response from the caller app

2.9. ApplicationMetaData

This interface defines the meta data of an installed application.

   [NoInterfaceObject] interface ApplicationMetaData {

    readonly attribute DOMString key;

    readonly attribute DOMString value;

  };

2.10. ApplicationInformationArraySuccessCallback

This interface invokes the success callback that is invoked when the installed application list is retrieved.

  [Callback=FunctionOnly, NoInterfaceObject] interface ApplicationInformationArraySuccessCallback {
    void onsuccess(ApplicationInformation[] informationArray);
  };

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.

Signature
void onsuccess(ApplicationInformation[] informationArray);
Parameters
  • informationArray
    • Optional: No.
    • Nullable: No.
    • Type: array.
    • Description: A list of installed applications.

2.11. FindAppControlSuccessCallback

This interface specified a success callback that is invoked when system finished searching applications which is matched by specific application control .

  [Callback=FunctionOnly, NoInterfaceObject] interface FindAppControlSuccessCallback {
    void onsuccess(ApplicationInformation[] informationArray, ApplicationControl appControl);
  };

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.

Signature
void onsuccess(ApplicationInformation[] informationArray, ApplicationControl appControl);
Parameters
  • informationArray
    • Optional: No.
    • Nullable: No.
    • Type: array.
    • Description: A list of installed applications.
  • appControl
    • Optional: No.
    • Nullable: No.
    • Type: ApplicationControl.
    • Description: The application control which were passed on ApplicationManager.findAppControl().

2.12. ApplicationContextArraySuccessCallback

This callback interface that specifies the success callback that is invoked when the list of running applications is retrieved.

  [Callback=FunctionOnly, NoInterfaceObject] interface ApplicationContextArraySuccessCallback {
    void onsuccess(ApplicationContext[] contexts);
  };

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.

Signature
void onsuccess(ApplicationContext[] contexts);
Parameters
  • contexts
    • Optional: No.
    • Nullable: No.
    • Type: array.
    • Description: A list of running applications.

2.13. ApplicationControlDataArrayReplyCallback

This callback interface specifies success callbacks that are invoked as a reply from the requested application control within the application control requester.

  [Callback, NoInterfaceObject] interface ApplicationControlDataArrayReplyCallback {
    void onsuccess(optional ApplicationControlData[]? data);

    void onfailure();
  };

This callback interface specifies two methods:

  • onsuccess() - Invoked by the callee application calls RequestedApplicationControl.replyResult().
  • onfailure() - Invoked if the callee application calls RequestedApplicationControl.replyFailure().

METHODS

onsuccess

Called when the callee application calls RequestedApplicationControl.replyResult().

Signature
void onsuccess(optional ApplicationControlData[]? data);
Parameters
  • data
    • Optional: Yes.
    • Nullable: Yes.
    • Type: array.
    • Description: An array of ApplicationControlData objects.

onfailure

Called when the callee application calls RequestedApplicationControl.replyFailure().

Signature
void onfailure();

2.14. ApplicationInformationEventCallback

The callback interface to specify for subscribing for notification of changes in the list of installed applications on a device.

  [Callback, NoInterfaceObject] interface ApplicationInformationEventCallback {
    void oninstalled(ApplicationInformation info);

    void onupdated(ApplicationInformation info);

    void onuninstalled(ApplicationId id);
  };

This callback interface specifies methods that will be invoked when an application is installed, updated, or uninstalled.

METHODS

oninstalled

Called when an application is installed.

Signature
void oninstalled(ApplicationInformation info);
Parameters
  • info
    • Optional: No.
    • Nullable: No.
    • Type: ApplicationInformation.
    • Description: The application information of the installed application.

onupdated

Called when an application is updated.

Signature
void onupdated(ApplicationInformation info);
Parameters
  • info
    • Optional: No.
    • Nullable: No.
    • Type: ApplicationInformation.
    • Description: The application information of the updated application.

onuninstalled

Called when an application is uninstalled.

Signature
void onuninstalled(ApplicationId id);
Parameters
  • id
    • Optional: No.
    • Nullable: No.
    • Type: ApplicationId.
    • Description: The ID of the uninstalled application.

3. Full WebIDL

module Application {

  typedef DOMString ApplicationId;

  typedef DOMString ApplicationContextId;

  [NoInterfaceObject] interface ApplicationManagerObject {
    readonly attribute ApplicationManager application;
  };
  WebAPIs implements ApplicationManagerObject;

  [NoInterfaceObject] interface ApplicationManager {

    Application getCurrentApplication() 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);


    DOMString getAppSharedURI(optional ApplicationId? id) raises(WebAPIException);

     ApplicationMetaData[] getAppMetaData(optional ApplicationId? id) raises(WebAPIException);

    long addAppInfoEventListener(ApplicationInformationEventCallback eventCallback) raises(WebAPIException);

    void removeAppInfoEventListener(long watchId) raises(WebAPIException);

  };

  [NoInterfaceObject] interface Application {

    readonly attribute ApplicationInformation appInfo;

    readonly attribute ApplicationContextId contextId;

    void exit() raises(WebAPIException);

    void hide() raises(WebAPIException);

    RequestedApplicationControl getRequestedAppControl() 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;

  };

  [NoInterfaceObject] interface ApplicationContext {

    readonly attribute ApplicationContextId id;

    readonly attribute ApplicationId appId;

  };

  [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)]
  interface ApplicationControl {

    attribute DOMString operation;

    attribute DOMString? uri;

    attribute DOMString? mime;

    attribute DOMString? category;

    attribute ApplicationControlData[] data;

  };

  [NoInterfaceObject] interface RequestedApplicationControl {

    readonly attribute ApplicationControl appControl;

    readonly attribute ApplicationId callerAppId;

    void replyResult(optional ApplicationControlData[]? data) raises(WebAPIException);

    void replyFailure() raises(WebAPIException);

  };

  


   [NoInterfaceObject] interface ApplicationMetaData {

    readonly attribute DOMString key;

    readonly attribute DOMString value;

  };


  [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);
  };

};