I am creating an app for Samsung watch 6 which is using WearOS. I want to show following health data directly from the watch, independent of it being connected to any phone.
I found a sample app for HearRate called MeasureDataCompose. This works fine for Heart Rate, I want to get all above data. The sample code is either not intuitive that I could get the data above, or there is something I dont understand. I could not find any help on this, which is very disappointing.
Health Services on Wear OS is an API that will allow you to get sensor data from any device running Wear OS 3 or higher. This is the API the sample you linked uses.
You can reference this page to learn about the 3 clients offered. Just as a quick overview:
The sample app linked uses MeasureClient
, which is suitable for instantaneous/spot measurement. You can query the capabilities to understand which metrics are supported for spot measurement on your device.
You can use PassiveMonitoringClient
to monitor steps in the background throughout the day. You can also monitor both steps and HR as part of an active exercise (ExerciseClient
).
You can also use Health Services to monitor UserActivityState
, which will tell you if a user is awake or has fallen asleep. Beyond this, there isn't a standardized way to measure sleep stages on Wear OS.
For the other metrics mentioned, you may want to look into the Samsung Privileged Health SDK if you are developing with a Galaxy Watch. This will enable you to get SPO2, Body Temperature, and access to PPG sensors.