Wearable Web

AppCaller and AppCallee Sample Overview

The AppCaller and AppCallee sample applications demonstrate how you can use the application control to call other applications based on the operation type.

For information on creating the sample application project in the IDE, see Creating Sample Applications.

The following figure illustrates the main screens of the AppCaller and AppCallee.

Figure: AppCaller and AppCallee screens

AppCaller and AppCallee screens

The AppCaller application is used to call the AppCallee application, which returns an emoji to the AppCaller:

  1. In the AppCaller, make the call by clicking Call App.

    In the AppCallee, information about the call is displayed on the screen along with a list of emojis.

  2. In the AppCallee, click the emoji you want to return to the AppCaller.

    The AppCaller displays the selected emoji.

Prerequisites

  • Since the AppCaller and AppCallee applications work best along with each other, both applications must be installed before you try to run either of them.

Source Files

You can create and view the sample application project including the source files in the IDE.

File name Description
appcallee/config.xml This file contains the application information for the platform to install and launch the application, including the operation type of the application.
appcallee/css/style.css This file contains CSS styling for the application UI.
appcallee/image/ This directory contains the images used to create the user interface.
appcallee/index.html This is a starting file from which the application starts loading. It contains the layout of the application screen.
appcallee/js/main.js This file contains the code for handling the main application functionalities.
appcaller/config.xml This file contains the application information for the platform to install and launch the application.
appcaller/css/style.css This file contains CSS styling for the application UI.
appcaller/image/ This directory contains the images used to create the user interface.
appcaller/index.html This is a starting file from which the application starts loading. It contains the layout of the application screen.
appcaller/js/main.js This file contains the code for handling the main application functionalities.
Note
The Emoji set used in this application was designed and offered free by Emoji One. For more information on their license terms, see the Emoji One site.

Implementation

In the AppCallee application, the <tizen:app-control/> element of the configuration file provides a service description for the application control. The operation name describes an action to be performed by the application.

<tizen:app-control>
   <tizen:src name="index.html">
   <tizen:operation name="http://tizen.org/appcontrol/operation/appcall"/>
</tizen:app-control> 

In the AppCaller application, the ApplicationControl interface (consisting of an operation, URI, MIME type, and data) describes an action to be performed by the Callee application. When the system gets the application control request, it finds the corresponding application to perform the requested application control and launches the selected application.

AppControl = new tizen.ApplicationControl('http://tizen.org/appcontrol/operation/appcall', 
                                          null, null, null);

In the AppCallee application, the replyAppCaller() function replies back to the AppCaller with the data on the selected emoji:

  • The application control request passed to the AppCallee can be accessed by the getRequestedAppControl() function. The passed application control contains the reason the application was launched and information about what the application is doing.
  • The ApplicationControlData interface defines the key-value pair used to pass data between applications, and it is sent to the AppCaller through the replyResult() function of the RequestedApplicationControl interface.
function replyAppCaller(text) 
{
   reqAppControl = tizen.application.getCurrentApplication().getRequestedAppControl();

   /* Construct result data */
   data = new tizen.ApplicationControlData("text", [text]);

   /* Reply to caller */
   reqAppControl.replyResult([data]);
   tizen.application.getCurrentApplication().exit();
}
Go to top