Track Deadlift Exercise on Galaxy Watch


Create a native app for Galaxy Watch, operating on Wear OS powered by Samsung, using Health Services to track deadlift exercise. This app measures repetition count, calories burned, and time spent during the exercise.


Health Services provides a simple and unified way for accessing a wide range of health and wellness related data. With Health Services API, you will no longer need to develop your own algorithms processing sensors data in order to compute metrics like heart rate, steps counts, distance, calories burned, and other more. These are now accessible through Health Services embedded on wearables operating on Wear OS powered by Samsung.

See Health Platform descriptions for detailed information.

Set up your environment

You will need the following:

  • Galaxy Watch4 or newer
  • Android Studio (latest version recommended)
  • Java SE Development Kit (JDK) 11 or later

Sample Code

Here is a sample code for you to start coding in this Code Lab. Download it and start your learning experience!

Health Track Deadlift Sample Code
(122.22 KB)

Turn on Developer Mode and adjust its settings

  1. On your watch, go to Settings > About watch > Software and tap on Software version 5 times.

  2. Upon successful activation of Developer mode, a toast message will display as on the image below.

  3. Afterwards, Developer options will be visible under Settings.

  4. Tap Developer options and enable the following options:

    • ADB debugging

    • Debug over Wi-Fi

    • Turn off automatic Wi-Fi

Connect your Galaxy Watch to Wi-Fi

  1. Go to Settings > Connection > Wi-Fi and make sure that Wi-Fi is enabled.
  2. From the list of available Wi-Fi networks, choose and connect to the same one as your PC.
  3. When successfully connected, tap a Wi-Fi network name, swipe down, and note the IP address. You will need this to connect your watch over ADB from your PC.

Connect your Galaxy Watch to Android Studio

In Android Studio, go to Terminal and type:

adb connect <IP address as mentioned in previous step>

When prompted, tap Always allow from this computer to allow debugging.

Upon successful connection, you will see the following message in Android Studio’s Terminal:

connected to <IP address of your watch>

Now, you can run the app directly on your watch.

Start your project

After downloading the sample code containing the project files, click Open to open existing project in Android Studio.

Locate the downloaded Android Project (deadlift) from the directory and click OK.

Check dependency and app manifest

In the dependencies section of deadlift/app/build.gradle file, see the appropriate dependency for Health Services.

dependencies {
	implementation ''
	// ...

In AndroidManifest.xml file, note the following:

  • <queries> element

    <package android:name="" />

  • section with requests for necessary permissions

<uses-permission android:name="android.permission.BODY_SENSORS" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />

Check capabilities

To check what can be measured during exercise, you need to check its capabilities. Follow these steps to obtain them:

Open and navigate to checkCapabilities function.
Prepare a ListenableFuture<ExerciseCapabilities> instance that will query for deadlift capabilities.

  • getCapabilities() checks exercise capabilities in exerciseClient object.

public void checkCapabilities() {
    ListenableFuture<ExerciseCapabilities> capabilitiesListenableFuture = null;
     * [Practice 1] Create ListenableFuture object that will get a callback with Exercise
     * Capabilities. Choose correct function from ExerciseClient
     * Uncomment line below and fill TODO 1
     *  (1) For checking capabilities use getCapabilities()
    //capabilitiesListenableFuture = exerciseClient.TODO 1;
            new FutureCallback<ExerciseCapabilities>() {
                public void onSuccess(@Nullable ExerciseCapabilities result) {
                    Log.i(TAG,"Got exercise capabilities");
                    try {
                        exerciseCapabilitiesSet = deadliftReader.getExerciseCapabilities(result);

Next, go to and navigate to getExerciseCapabilities function.

  • getSupportedDataTypes() gets measurable data types in exerciseTypeCapabilities.

public Set<DataType> getExerciseCapabilities(ExerciseCapabilities result) throws DeadliftException
    if(result == null)
        throw new DeadliftException("ExerciseCapabilities is null");
    ExerciseTypeCapabilities exerciseTypeCapabilities =
    Set<DataType> dataTypeSet = null;
     *  [Practice 1] Read set of deadlift capabilities. Choose correct function from Exercise
     *  Type Capabilities.
     * --------------------------------------------------------------------------------------
     *  Uncomment line below and fill TODO 2
     *      - For checking Deadlift capabilities use getSupportedDataTypes()
    //dataTypeSet = exerciseTypeCapabilities.TODO 2;
    return dataTypeSet;

Register an event for deadlift state update

In, navigate to startExerciseUpdateListener() function.

  • To get exercise updates, you need to set a listener using setUpdateListener(exerciseUpdateLisener).

public void startExerciseUpdateListener() throws DeadliftException
    if(exerciseClient == null)
        throw new DeadliftException("Exercise Client is null");
     *  [Practice 2] Create ListenableFuture object that will get a callback with Exercise
     *  Capabilities. Choose correct function from ExerciseClient
     *  Uncomment line below and fill TODO 3
     *  For setting update listener use setUpdateListener(exerciseUpdateListener)
    ListenableFuture<Void> updateListenableFuture = null;
    //updateListenableFuture = exerciseClient.TODO 3;
    if(updateListenableFuture == null)
        throw new DeadliftException("Update is null");
            new FutureCallback<Void>() {
                public void onSuccess(@NullableDecl Void result) {
                    Log.i(TAG, "Successfully set update listener");
                    isMeasurementRunning = true;

Check the updated event

To work with the data provided by an exercise, you need to get the latest reading metrics. In, navigate to updateRepCount() function.

  • getLatestMetrics() gets the latest readings from an Exercise update.

public void updateRepCount(ExerciseUpdate update) throws DeadliftException {
     *  [Practice 3] Create map object that will get readings from the update
     *  Choose correct function from ExerciseUpdate class
     * -------------------------------------------------------------------------------------
     *  Uncomment line below and fill TODO 4
     *  For reading latest values from update use getLatestMetrics()
    Map<DataType, List<DataPoint>> map = null;
    if (update == null)
        throw new DeadliftException("Exercise update is null");
    //map = update.TODO 4;
    if (map.isEmpty())

Run unit tests

For your convenience, you will find an additional Unit Tests package. This will let you verify your code changes even without using a physical watch. See instruction below on how to run unit tests:

  1. Right click on (test) > DeadliftUnitTest and execute Run 'DeadliftUnitTest' command.

  1. If you completed all the tasks correctly, you will see all the unit tests passed successfully.

Run the app

After building the APK, you can run the application on a connected device to measure actual deadlift parameters.

  1. Right after the app is started, it will request for the user permission. Allow the app to receive data of the activity.

  1. Afterwards, the application main screen will be shown. Before doing deadlifts, press the START button to track your exercise. When done, tap on the STOP button.

You're done!

Congratulations! You have successfully achieved the goal of this Code Lab. Now, you can create a deadlift exercise tracker app by yourself! If you're having trouble, you may download this file:

Health Track Deadlift Complete Code
(122.24 KB)

Learn more by going to Health Platform.