Hello, I was trying to read sensor data periodically (e.g. 25Hz) with Web application API.
I used JavaScript setTimeout() function with 40ms timeout, yet I encountered two problems:
1. Reading sensor data finished earlier than I expected.
I used callback functions that (1) increases the global counter and (2) setTimeout with 40ms for next read. I set repetition number to 150 to get sensor data for 6s. However 150 samples are filled much earlier than I expected (e.g. 4s).
2. Widget is not working when the watch face is downside.
I found out that when the watch face is downside, the widget is not working in the background, thus not reading the data. I am trying to gather sensor data to distinguish different gestures, where watch faces often goes downside.
So I want the sensor data to be collected in the background. Thus, I am finding ways to reliably gather data (1) with accurate time interval (e.g. 40ms) (2) in the background, even when the watch face is downside.
Is it possible to implement these sensor service with Web Application (JavaScript)? Or should I move to Native application? Thanks!