HealthData

@ExperimentalGlanceWearApi
object HealthData


A representation of health data managed by Health Services.

This provides access to various health metrics that can be used in Glance Wear Widgets, such as heart rate and daily activity totals.

Summary

Public properties

RemoteInt

Heart rate data is available with high accuracy.

RemoteInt

Heart rate data is available but the accuracy is low.

RemoteInt

Heart rate data is available and the accuracy is medium.

RemoteInt

Heart rate cannot be acquired because the sensor is not properly contacting skin.

RemoteInt

Heart rate accuracy is unknown.

RemoteInt

Heart rate data is currently too unreliable to be used.

RemoteFloat

The total number of calories burned over a day (including both BMR and active calories), expressed in kilocalories (kcal).

RemoteFloat

The total distance traveled over a day, expressed in meters.

RemoteFloat

The total number of floors climbed over a day.

RemoteInt

The total step count over a day.

RemoteInt

Heart rate sensor accuracy data.

RemoteFloat

Current heart rate, in beats per minute.

RemoteBoolean

Returns true if dailyCalories is available on the host, false otherwise.

RemoteBoolean

Returns true if dailyDistanceMeters is available on the host, false otherwise.

RemoteBoolean

Returns true if dailyFloors is available on the host, false otherwise.

RemoteBoolean

Returns true if dailySteps is available on the host, false otherwise.

RemoteBoolean

Returns true if heartRateBpm is available on the host, false otherwise.

Public properties

HEART_RATE_ACCURACY_HIGH

Added in 1.0.0-alpha19
val HEART_RATE_ACCURACY_HIGH: RemoteInt

Heart rate data is available with high accuracy.

HEART_RATE_ACCURACY_LOW

Added in 1.0.0-alpha19
val HEART_RATE_ACCURACY_LOW: RemoteInt

Heart rate data is available but the accuracy is low.

HEART_RATE_ACCURACY_MEDIUM

Added in 1.0.0-alpha19
val HEART_RATE_ACCURACY_MEDIUM: RemoteInt

Heart rate data is available and the accuracy is medium.

HEART_RATE_ACCURACY_NO_CONTACT

Added in 1.0.0-alpha19
val HEART_RATE_ACCURACY_NO_CONTACT: RemoteInt

Heart rate cannot be acquired because the sensor is not properly contacting skin.

HEART_RATE_ACCURACY_UNKNOWN

Added in 1.0.0-alpha19
val HEART_RATE_ACCURACY_UNKNOWN: RemoteInt

Heart rate accuracy is unknown.

HEART_RATE_ACCURACY_UNRELIABLE

Added in 1.0.0-alpha19
val HEART_RATE_ACCURACY_UNRELIABLE: RemoteInt

Heart rate data is currently too unreliable to be used.

dailyCalories

Added in 1.0.0-alpha19
val dailyCalories: RemoteFloat

The total number of calories burned over a day (including both BMR and active calories), expressed in kilocalories (kcal).

It resets when 00:00 is reached in the device's current timezone. This can result in the daily period being greater or less than 24 hours if the timezone is changed.

Check isDailyCaloriesAvailable to determine if this metric is available on the host.

Required permission: Manifest.permission.ACTIVITY_RECOGNITION

dailyDistanceMeters

Added in 1.0.0-alpha19
val dailyDistanceMeters: RemoteFloat

The total distance traveled over a day, expressed in meters.

It resets when 00:00 is reached in the device's current timezone. This can result in the daily period being greater or less than 24 hours if the timezone is changed.

Check isDailyDistanceMetersAvailable to determine if this metric is available on the host.

Required permission: Manifest.permission.ACTIVITY_RECOGNITION

dailyFloors

Added in 1.0.0-alpha19
val dailyFloors: RemoteFloat

The total number of floors climbed over a day.

It resets when 00:00 is reached in the device's current timezone. This can result in the daily period being greater or less than 24 hours if the timezone is changed.

Check isDailyFloorsAvailable to determine if this metric is available on the host.

Required permission: Manifest.permission.ACTIVITY_RECOGNITION

dailySteps

Added in 1.0.0-alpha19
val dailySteps: RemoteInt

The total step count over a day.

It resets when 00:00 is reached in the device's current timezone. This can result in the daily period being greater or less than 24 hours if the timezone is changed.

Check isDailyStepsAvailable to determine if this metric is available on the host.

Required permission: Manifest.permission.ACTIVITY_RECOGNITION

heartRateAccuracy

Added in 1.0.0-alpha19
val heartRateAccuracy: RemoteInt

Heart rate sensor accuracy data. The accuracy value is one of HEART_RATE_ACCURACY_* constants.

If permission for heartRateBpm is not granted, heartRateAccuracy will be HEART_RATE_ACCURACY_UNKNOWN.

heartRateBpm

Added in 1.0.0-alpha19
val heartRateBpm: RemoteFloat

Current heart rate, in beats per minute.

Check isHeartRateBpmAvailable or heartRateAccuracy for more detailed information to determine if this metric is available on the host.

Required permissions are:

isDailyCaloriesAvailable

Added in 1.0.0-alpha19
val isDailyCaloriesAvailable: RemoteBoolean

Returns true if dailyCalories is available on the host, false otherwise.

A health data type may be unavailable if the permission wasn't granted or if the host cannot retrieve it.

If false, dailyCalories will return its default value.

isDailyDistanceMetersAvailable

Added in 1.0.0-alpha19
val isDailyDistanceMetersAvailable: RemoteBoolean

Returns true if dailyDistanceMeters is available on the host, false otherwise.

A health data type may be unavailable if the permission wasn't granted or if the host cannot retrieve it.

If false, dailyDistanceMeters will return its default value.

isDailyFloorsAvailable

Added in 1.0.0-alpha19
val isDailyFloorsAvailable: RemoteBoolean

Returns true if dailyFloors is available on the host, false otherwise.

A health data type may be unavailable if the permission wasn't granted or if the host cannot retrieve it.

If false, dailyFloors will return its default value.

isDailyStepsAvailable

Added in 1.0.0-alpha19
val isDailyStepsAvailable: RemoteBoolean

Returns true if dailySteps is available on the host, false otherwise.

A health data type may be unavailable if the permission wasn't granted or if the host cannot retrieve it.

If false, dailySteps will return its default value.

isHeartRateBpmAvailable

Added in 1.0.0-alpha19
val isHeartRateBpmAvailable: RemoteBoolean

Returns true if heartRateBpm is available on the host, false otherwise.

Heart rate availability is determined by the sensor's contact and reliability. It is considered available if heartRateAccuracy is HEART_RATE_ACCURACY_LOW, HEART_RATE_ACCURACY_MEDIUM, or HEART_RATE_ACCURACY_HIGH.

A health data type may be unavailable if the permission wasn't granted or if the host cannot retrieve it.

If false, heartRateBpm will return its default value.