android / health-samples

Apache License 2.0
242 stars 138 forks source link

Latency of Heart Rate When Starting Exercise #274

Open Sanya-L opened 3 days ago

Sanya-L commented 3 days ago

Hi, I'm a beginner in Android, Wear OS, and health services. Currently, I want to collect data such as heart rate and calories over a specific period, like 2 minutes.

  1. I've tried using ExerciseSample and ExerciseSampleCompose, but I'm not sure about the differences between them since their functions seem quite similar.
  2. Also, I believe that the data retrieved on the frontend is accurate, as it's collected by the sensor, but can it compete with the data provided by Samsung Health?
  3. I noticed a latency in the heart rate readings when starting exercise, typically taking about 6-10 seconds. Why is there a delay, and why doesn't the sensor reflect the heart rate instantly when the exercise starts?
  4. I noticed that Health Services perform standardized calculations for data such as calories. How can I adjust these calculations to account for age and weight?
breanatate commented 2 days ago

Hey, thanks for the questions!

  1. ExerciseSample and ExerciseSampleCompose demonstrate the same behaviors. ExerciseSampleCompose uses Compose for Wear OS, which is the recommended UI framework. We'll be deprecating the ExerciseSample in favor of ExerciseSampleCompose soon.
  2. The data does not compete, but Health Services on Wear OS only allows one app to be running an active exercise at a time. Therefore, if you run ExerciseSampleCompose first, it should stop running once you start an exercise in Samsung Health. Is this what you are referring to? Samsung Health will still be able to track daily metrics in the background.
  3. The HR sensor takes some time to warm up -- this is handled by prepareExercise (in the Exercise Sample this happens in the GPS acquisition screen). The amount of time the sensor needs to warm up may vary by device.
  4. This happens through the default fitness app (i.e. Samsung Health for Galaxy Watches, Fitbit for Pixel Watches, etc). The default fitness app syncs the user profile back with WHS so the calculations can be adjusted based on height, weight, etc.
Sanya-L commented 2 days ago

Hi Breanatate,

Thank you for your prompt reply. I have clarified some questions, as I believe I didn't explain them clearly before:

  1. The data received and displayed by the health service is through the watch's own sensor, so I think it should be accurate. I am curious whether the health service data is as accurate as the data in Samsung Health.

  2. Does this mean that WHS will automatically sync data such as age and weight from other fitness apps? For example, if I use a Samsung watch with Samsung Health, will WHS get age and weight data from Samsung Health? Will this data be added to the algorithm and influence the results? I want age and weight to be factors that affect the data, like how a heavier person might burn more calories than a thinner person, or how a younger person might burn more than an adult.