언어 설정

Menu
Sites
Language
Service application question related to hybrid service code examples

Greetings all, I've been working with Tizen development for a few weeks and this is my first post. I'm developing a hiking app for wearable that needs to collect location data. I've decided to create a Hybrid web and service application so the service application can collect location/gps data and run in the background. I've modeled it after and am using the code from the Hybrid web and native service examples:

 

https://developer.tizen.org/development/sample/web/Hybrid/Hybrid_Web_App

https://developer.tizen.org/development/sample/native/AppFW/Hybrid_Service

 

After struggling for a few weeks I have the app working rather nicely and understand most of the code related to the client and server commands and messages.

What I do not understand is the many parts of the native service application the relate to timers and threads. At first I thought they were integral to making the server listen for commands. I noticed there is also a thread while loop that will send a message after 1 second when there is no command sent.

I have since realized that all of this code actually doesn't do anything useful?! My questions are:

  • Can anyone explain to me in plain english what this code actually does?
  • Does it keep the service running in the background?
  • Does it run the commands in a seperate thread?
  • Does it hog resources by leaving it in there?
  • Is it safe to strip out all code related to phread and timers?

I want my app to be lean and mean and not hog resources since this is running on a watch for hours on end.

Thank you all!

Edited by: Kyle Kirkpatrick on 25 8월, 2020