Declare appropriate permissions

Health Services on Wear OS uses the following distinct permissions:

Consult the following table to determine which permissions are necessary for your app, based on the types of fitness data that you want to present to users. Make sure to follow the basic principles for requesting permissions, including asking for permissions in context.

If your app targets API level 36 or higher, and if it uses PassiveMonitoringClient to access body sensor information in the background, request the READ_HEALTH_DATA_IN_BACKGROUND permission. If your app targets an API level between 33 and 35 inclusive, request both the BODY_SENSORS and BODY_SENSORS_BACKGROUND permissions instead.

Data type Permission
CALORIES
CALORIES_DAILY
DISTANCE_DAILY
DECLINE_DISTANCE
DISTANCE
ELEVATION_GAIN
ELEVATION_LOSS
FLAT_GROUND_DISTANCE
FLOORS
FLOORS_DAILY
GOLF_SHOT_COUNT
INCLINE_DISTANCE
PACE
REP_COUNT
RUNNING_STEPS
SPEED
STEPS
STEPS_DAILY
STEPS_PER_MINUTE
SWIMMING_LAP_COUNT
SWIMMING_STROKES
CALORIES_TOTAL
WALKING_STEPS
UserActivityInfo
UserActivityState
ACTIVITY_RECOGNITION
HEART_RATE_BPM READ_HEART_RATE
ABSOLUTE_ELEVATION
LOCATION
ACCESS_FINE_LOCATION

Migrate to support API level 36

If your app targets Wear OS 6 (API level 36) or higher, follow these steps to migrate your app to supporting the latest versions of the Wear OS platform:

  1. In your manifest file, add the maxSdkVersion for the legacy permission, as well as the modern READ_HEART_RATE permission:

    <uses-permission android:name="android.permission.BODY_SENSORS"
                     android:maxSdkVersion="35" />
    <uses-permission android:name="android.permission.health.READ_HEART_RATE" />
    
  2. If your app requires access to body sensors while running in the background, add the maxSdkVersion for the legacy background permission, and add the modern READ_HEALTH_DATA_IN_BACKGROUND permission:

    <uses-permission android:name="android.permission.BODY_SENSORS_BACKGROUND"
                     android:maxSdkVersion="35" />
    <uses-permission android:name="android.permission.health.READ_HEALTH_DATA_IN_BACKGROUND" />
    
  3. Request and confirm that the heart rate permission is granted everywhere your app checks for the BODY_SENSOR and BODY_SENSORS_BACKGROUND permission, filtering by Wear OS version. For example:

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) {
        this.add(HealthPermissions.READ_HEART_RATE)
    }