Tizen web app service

Tizen web app service

BY 19 Mar 2015 Web Application Development

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” !

Written by