title: Is it possible to keep Tizen application alive non stop
body: <p>recently I’ve started developing for Tizen OS. My application is created only for wearable and only for specific device which is Samsung Gear Sport (Tizen 3.0 on board). Main purpose of this application is to gather complete sensor data over a long period of time. I’m interested in heart rate, and movement sensors in general (gyroscope and accelerometer). Then, this data will be send to cloud server and analysed. Currently I’m considering a WEB application because so far I have found no evidence that WEB API is missing something that exists in native API.</p>
  
  <p>But there is one limitation in Tizen OS that so far I am unable to overcome. My application is put to sleep after a while (10 minutes or so). It is crucial that this app should work in the background for a long time (up to 10 hours). To achieve this, I’ve tried following approaches:</p>
  
  <ul>
  <li><strong>Normal Tizen app with background-category:</strong> data given by this approach is still too fragmented, for example I got 15 minutes holes where no data was recorded at all. Sometimes there were holes even longer than 30 minutes.</li>
  <li><strong>Tizen alarms API:</strong> alarms did the job in case of keeping the app alive, but with every alarm, app was brought to the front and this is not an acceptable solution. There is an option to silently wake up the app (using app control), but it does not have any callback, so all alarms would have to be scheduled upfront.</li>
  <li><strong>CPU_AWAKE flag</strong> made the system show “this app is using too much energy” popup, and when not answered within 10 minutes or so, system would kill my app nonetheless.</li>
  <li><strong>Web Workers</strong> - this one is only for the sake of argument, web workers are put to sleep along with the application</li>
  <li><strong>Data recording:</strong> I was hoping for something similar to Apple Health Kit, but instead I got something that is not working for HRM at all. Somehow it works for <code>PRESSURE</code> sensor. Tizen allows to start recording for <code>HRM</code> but nothing is recorded after - <code>NotFoundError: Failed to read recorded data</code>. Any other sensor  gives <code>TypeMismatchError</code>.</li>
  <li><strong>Web Service app</strong> - this one requires partner-level certification with Samsung, also it’s affected by the background limitations, <a href="https://developer.tizen.org/ko/development/guides/native-application/application-management/applications/service-application?langredirect=1" rel="noreferrer">as the documentation mentions.</a> </li>
  <li><strong>Watch Face</strong> approach with “keep always on” flag set to true in device settings. This solution was the best I’ve tried. Watch face app wakes up every minute to change the time and it also receives sensor data. Unfortunately after more testing it turned out that there were couple holes in the data recorded.</li>
  </ul>
  
  <p>About the battery: none of the above was draining the battery to a point where it became unacceptable. So first I’d like to find a solution that will give me all the sensor data I need, as frequently as possible from at least 10 hours, with no holes in it. And after that, if it turns out that this solution is draining too much battery, I will think about how to optimize it.</p>
  
  <p>And now the question: <strong>is it possible to keep my application alive for 10+ hours non stop?</strong></p>