health-samples icon indicating copy to clipboard operation
health-samples copied to clipboard

Exercise and ambient mode

Open Secretbox1987 opened this issue 2 years ago • 1 comments

I start the exercise, after a while it goes into ambient mode and the data starts coming in once a minute. i added an alarm manager and wake up the app every 5 seconds, but the health service still returns the data 1 time per minute

Secretbox1987 avatar Jun 26 '22 20:06 Secretbox1987

This is the expected behavior: to preserve power, health services will deliver data in batches, see Work with data from ExerciseClient. (The exact rate and behaviour depends on the hardware.)

So even if your app itself is woken up every 5 seconds, health services will not deliver data at that frequency. What is your use case? For most data types you should receive multiple data points within each batch—the sensors are recording data at a higher rate than the rate at which it is delivered by health services—which should be sufficient if ambient mode is active.

ithinkihaveacat avatar Jun 26 '22 21:06 ithinkihaveacat