
The Samsung Health Sensor SDK enables your application to collect vital signs and other health parameters tracked on Galaxy Watch running Wear OS powered by Samsung. The tracked data can either be shown right away or saved for later analysis. Some kinds of tracked data, such as batching data, are impractical to display on a watch screen in real-time, so it is common to store the data in a database or server solution or show them on the larger screen of a mobile device.
This blog demonstrates how to develop two connected sample applications. The Samsung Health Sensor SDK is used by a watch application to collect data from a heart rate tracker. The Wearable Data Layer API is used to send the data to a companion application on the user’s Android mobile device, where it is displayed as a straightforward list. You can follow along with the demonstration by downloading the sample application project. You need an Android smartphone that is connected and a Galaxy Watch4 or later to test the applications. The application project’s creation The application project consists of a wearable module for the watch, and a mobile module for Android mobile devices:
Select Open File > New > New Project in Android Studio. Select Wear OS > Empty Wear App and click Next.
Define the project details
To create a companion mobile application for the watch application, check the Pair with Empty Phone app box.
For more information about creating multi-module projects, see From Wrist to Hand: Develop a Companion App for Your Wearable Application.
Implementing the watch application
The watch application UI has two buttons. The Start/Stop button controls heart data tracking, and the Send button transfers the collected data to the connected mobile device. Due to the fact that a single tracking result may contain up to four IBI values, the screen includes a heart rate field in addition to four IBI value fields. Gather and analyze heart rate data When the user taps the Start button on the wearable application UI, the startTracking() function from the MainViewModel class is invoked.
Since the capabilities that are supported depend on the model of the device as well as the software version, the application must verify that the Galaxy Watch supports the heart rate tracking feature that we wish to implement.