The application control allows you to launch other applications whose functionalities you need in your application. Basically, launching an application control means that if you need an application that provides certain functionality, you can request that the system launches it according to your requirements. The application control allows you to launch applications without knowing their identifiers or specifications, based on your immediate needs.
When the system gets an application control request, it finds the proper control provider application, and launches it. Once the provider application has performed the requested task, it must pass control back to the requesting application with the result of the operation it has provided. To do this, the provider application calls the getRequestedAppControl() method of the Application interface to get the reference of the RequestedApplicationControl object that has been passed to it with the control request. Then, the provider application calls either the replyResult() method (in case of success) or the replyFailure() method (in case of failure) of the RequestedApplicationControl interface to return the control back to the requesting application. The result of the provided operation (if any), is delivered as an array of ApplicationControlData objects. The result is received in the original calling application through the ApplicationControlDataArrayReplyCallback event handler.
There are different types of application control requests:
- Explicit launch
If you specify the exact application ID of the application for the launchAppControl() method of the Application interface, you can request the application control from a specific application. The application ID determines which application is launched and the application performs the operation as specified in the control request.
- Implicit launch
If you do not provide an exact application ID with the control request in the launchAppControl() method, you must provide enough information for the system to determine which of the available applications can best handle the control request (for example, the nature of the service or the file types that the application can handle).
The following attributes are used to resolve which application is launched:
Mandatory string that defines the action to be performed by the application control. You can define your own operation to describe a specific action of your application.
The following table lists the standard operations and data keys for delivering specific data to launch or return.
Table: Standard operations Operation Key Description http://samsungapps.com/appcontrol/operation/view -
Display the requested data (show an image or text, or play music or a video). The URI scheme must contain the path to the requested data.
Make a call to a specific phone number. The URI scheme must be tel: or set to NULL.
Provide a selection window for requested items and return the selection. The return value (the path to the selected item) must be stored with the data key.
http://samsungapps.com/appcontrol/operation/create_content http://samsungapps.com/appcontrol/data/selected Create content (such as a photo or video). The return value (the path to the created content) must be stored with the data key. http://samsungapps.com/appcontrol/operation/dial -
Show the dialer UI and dial a number using the requested phone number. The URI scheme must be tel: or set to NULL. If the URI scheme is NULL, the dialer UI is shown without a phone number.
Share content (for example, share a picture with friends using SNS services). The URI scheme must contain the path of the data.
Share multiple files. Each data path must be saved as an ApplicationControlData object with the data key.
- URI scheme
Data on which the action is performed.
- MIME type
Specific type of the URI.
- Application control data
Key-value pairs providing additional information for the control request. They can also be used for the result of the request.
The system compares the attributes of the control request against the installed applications to determine which of the available applications is most suitable for the control request. The control request is resolved only if all specified information matches the service descriptions retrieved from the installed applications. The application control data attribute is not used in resolving the control request.
To allow other applications to use the functionalities of your application (basically, to allow the system to launch your application based on a request from another application), you can define 1 or more application service descriptions in the config.xml file. Each service description specifies the operation, URI scheme, and MIME type of the application control service your application can offer:
<sec:app-control> <src name="[PAGE]"/> <operation name="[OPERATION]"/> <uri name="[URI_SCHEME]"/> <mime name="[MIME_TYPE]"/> </sec:app-control>
The src attribute is the application page (usually an HTML file) that handles the request.The operation is mandatory attribute, while the scheme and mime attributes are optional. If the scheme attribute is file, the attribute can be left out.
Base Application Controls
Samsung Web API provides base applications, such as Web browser, image viewer, music player, and video player. Using the ApplicationControl interface, you can easily use the functionality of the applications. The following table lists the services provided by the Samsung Web applications.
|Browsing a Web page||http://samsungapps.com/appcontrol/operation/view||
|Selecting a file||http://samsungapps.com/appcontrol/operation/pick||file||
|Displaying an image||http://samsungapps.com/appcontrol/operation/view||
|Playing a video file||file||
|Playing a sound file||
|Samsung Web API provides support for the defined MIME types of the base application services depending on the platform implementation.|