Languages

Menu
Sites
Language
Tizen web app service

Hi,

I am totally new to Javascript and Tizen webapp in general. I have developed an application which is supposed to call an api to fetch data from internet. (the fetching part is working fine). The problem is how do I call that api periodically (say once every day) when the app is closed and if the fetched data contain some particular pattern, I have to notify user. I know there is ALARM api for that but it launches the complete application with UI after the period which I do not want. I just want to call that api in background to fetch data and then notify user about it. 

I have seen docs related to services, but that has some concepts of "module.exports" and all which are out of my understanding. Could somebody please tell how to start/launch the service and in which part of the code I need modification ?

My config.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://yourdomain/basicweb" version="1.0.0" viewmodes="maximized">
    <access origin="*" subdomains="true"></access>
    <tizen:application id="CrcN9FCNmp.basicweb" package="CrcN9FCNmp" required_version="1.0"/>
    <content src="index.html"/>
    <feature name="http://tizen.org/feature/screen.size.all"/>
    <feature name="http://tizen.org/api/tizen" required="true"/>
    <feature name="http://tizen.org/api/alarm" required="true"/>
    <icon src="icon.png"/>
    <name>basicweb</name>
    <tizen:privilege name="http://tizen.org/privilege/alarm"/>
    <tizen:privilege name="http://tizen.org/privilege/application.info"/>
    <tizen:privilege name="http://tizen.org/privilege/application.launch"/>
    <tizen:privilege name="http://tizen.org/privilege/notification"/>
    <tizen:setting screen-orientation="portrait" context-menu="disable" background-support="enable" encryption="disable" install-location="auto" hwkey-event="enable"/>
    
    <tizen:service id="CrcN9FCNmp.service" auto-restart="true" on-boot="true">
      <tizen:content src="js/service.js"/>
      <tizen:name>[WebService]</tizen:name>
      <tizen:description>[Description]</tizen:description>
   </tizen:service>
    
    
</widget>

and this is the tutorial I am following https://developer.tizen.org/documentation/wearable-web-app-programming/tutorials/web-service-application-tutorial which explains the creation, packaging, launching of the service ?

Also tell me if I need Service at all for the required purpose ?

Note: When I tried to launch service using 

tizen.application.launchAppControl(new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/service"),
            "CrcN9FCNmp.service",
            function() {alert("Launch Service succeeded"); },
            function(e) {alert("Launch Service failed : " + e.message);});

it says, "Launch Service Failed: given package is not found" !

Edited by: Dheeraj Khoriya on 19 Mar, 2015

Responses

6 Replies
AVSukhov

Hello,

The wearable service application requires partner-level certification in Tizen 2.3.

You must be registered as partner on Tizen Store.

 

 

Dheeraj Khoriya

Thanks for the reply but this is not a wearable web application. This is mobile web application but I thought the service part would be the same for mobiles too so that is why I was following that tutorial

AVSukhov

Hello,

As I known, web service supported only for Wearable platform.

For Mobile Web app you can use Hybrid web app with native service:

https://developer.tizen.org/dev-guide/2.3.0/org.tizen.mobile.web.appprogramming/html/app_dev_process/multiple_project_dev_package.htm

Dheeraj Khoriya
Thanks again. Its a relief to hear that services are not enabled for mobile web app and they have to be created in Native app. Now I am thinking if, at all, I need service to implement my requirement. As I only need to call the javascript api periodically after a certain time interval, is it not possible to just trigger a .js file after that period and not load the complete html file which will launch the app ?
Alex Dem

Hi,
Unfortunately looks like there is no way to launch web app without UI (in background mode). You could avoid 'html' loading, but white rectangle should be shown in any case. 
I checked  this when I tried to perform application.hide() for current app in onInit(), before page loading.
Also I did not find mechanism for native app (like JavaScriptBridge in Tizen 2.2.1) to perform javascript methods from native apps. But in any case native service is app without UI and you could not use WebView component.
I could suppose look at curl and try to perform some http requests (if it is possible for your case) from native service using curl api https://developer.tizen.org/dev-guide/2.3.0/org.tizen.mobile.native.apireference/group__OPENSRC__CURL__FRAMEWORK.html.
But maybe someone else could propose better idea.
Alexey.

Dheeraj Khoriya

Yes,

There isn't any service application in web environment. I have implemeted the same in Native. Also used CURL to access internet and fetch data.

 

Thanks for your help.