I am trying to build a native tizen app which will detect activity and collect sensor data periodically to upload to a remote http server.
For this I have developed two things.
1. A Native UI Application to Start/Stop the
2. A Service application
I am developing the project in tizen studio with a samsung gear fit 2 pro connected via remote device manager over wifi.
When I run my app it works fine while my device is connected to sdb.
But when I disconnect the device it starts doing non-deterministic behavior.
For example, while it's connected to tizen studio, App records data for first 15s of every 60s and on the 16th second it uploads that file to server. It also starts on callback of activity change.
But as soon as the device is disconnected, that interval is not maintained properly i.e. sensors read data after 30 minutes(that also varies) and even frequency of data collection for every second is reduced dramatically. But if the UI app is in foreground then again everything is okay.
So, my app works normally if it's foreground or it's in foreground/background and device is connected to sdb on pc.
How can I make my service to run always in background irrespective of device's connection to tizen sdb on PC?
N.B. Data Upload is done using libcurl and that uses a timeout of 5s for connection and on failure it skips uploading. Ecore Timer is used but timer should not be a problem as I have tested by running sensor always but frequency decrease issue still persists. Sensor starting options in service app are as follows
sensor_get_default_sensor(sensor_type, &sensor);
sensor_create_listener(sensor, &listener[sensor_type]);
sensor_listener_set_event_cb(listener[sensor_type], 1000 / SENSOR_FREQ, example_sensor_callback, vc);
sensor_listener_set_option(listener[sensor_type], SENSOR_OPTION_ALWAYS_ON);
sensor_listener_start(listener[sensor_type]);