Interacting with a Tizen platform service

Gabor Paller's picture

Some APIs in Tizen are based on public standards like jQuery Mobile widgets, some other APIs are characteristic to Tizen. Application API is one of the Tizen-specific APIs.

You can do three different things with the Application API.

  • Launch other applications
  • Define application services that are able to receive calls from other applications or application services and return result values
  • Invoke those application services

Some of the application services are built into the platform. In this post we will interact with one of them to demonstrate application service invocation.


The example project is attached to this post. You have to be logged into the Sfonge site to access it.


In order to invoke an application service, it has to be identified by either explicitly, by the application ID that hosts the service or  by implicitly, providing only service characteristics. The mechanism is very similar to Android's explicit and implicit intents. Similarly, in Tizen it is called explicit and implicit launch.


In this example we will invoke one of the platform services, the gallery by implicit launch. An implicit launch is identified by 3 parameters: operation, URI and MIME type. At least one of them needs to be specified. Implicit launch parameters are encapsulated into a tizen.ApplicationService instance. From the example program:


   var appService =
       new tizen.ApplicationService(
                  "image/*" );


Here we specified operation and MIME type but not the URI. The appcontrol scheme may be familiar for those who know bada. The list of platform services can be found in the Tizen programming guide. The particular platform service performs image selection from the device's Gallery application. The selected image is returned to the application that invoked the platform service.

Once we specified the service, we invoke it.


          function() {
              console.log("launch service succeed");
          function(e) {
              console.log("launch service failed. reason: " + e.message);


The serviceReplyCallback object has two important properties: onsuccess and onfail which must have two functions bound to them. Onsuccess is called when the service returns successful result, onfail allows the service to signal erroneous operation. Onsuccess receives a reply parameters and the service result can be obtained from this object.


                var imgstr = reply[0].value[0];


In this example we add an img tag to our application's main screen to display the image selected in the Gallery application.


Access to the application API is controlled by permissions. Open the config.xml file in the project's main directory and look for the permission. This allows access to all the features of the Application API.


This example program does not work in the web simulator, the Gallery service is simply not implemented in the web simulator platform. The emulator, however, executes the application correctly. If you try it, be advised however, that the emulator is very slow. It takes about 15 minutes to launch the application in a running emulator instance, click the button (don't be impatient, click only once and wait, otherwise the emulator will get confused!), interact with the Gallery platform application and wait for our application to update its screen.

Attached file: