health-samples
health-samples copied to clipboard
Exercise and ambient mode
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
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.