Confusions on reading Health data from Wear OS watch on Android

591 Views Asked by At

I am creating an app for Android phones. I want to read data from Samsung watch 5 in that app. There is a lot of confusion.

Should I use

  • Google Fit API

OR

  • Health Connect ?

I started with "Health Connect" as I am under the impression that it'll fetch the Health data from the Samsung Health app. Am I thinking in right direction?

From here https://github.com/android/health-samples I fetched the Health Connect Sample app, and installed it on my Android phone. I thought it'll fetch the data from Samsung Health app, but it does not do it. It writes some sample data and then reads it back.

I want to read health data coming from the watch, how do I achieve this?

1

There are 1 best solutions below

2
On BEST ANSWER

Health Connect will allow you to read data from the Samsung Health app only if the Samsung Health app writes that data type to Health Connect. This guide can help you understand which situations Health Connect is best suited for.

If you want to read data directly from the Galaxy Watch (and other Wear OS devices) while the exercise is in progress, you should consider using the Health Services for Wear OS API and create a Wear OS app, then connect that app to your mobile app. Samples are in the same repository.

Now to get data from watch to mobile you can use:

  1. Wearable Data Layer API or
  2. Send data using the network.

This link has details on both options: developer.android.com/training/wearables/data/data-layer