# PlatformHealthSources

Artifact: [androidx.wear.protolayout:protolayout-expression](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/expression/PlatformHealthSources.java+class:androidx.wear.protolayout.expression.PlatformHealthSources) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/wear/protolayout/expression/PlatformHealthSources "View this page in Java")


```
class PlatformHealthSources
```

<br />

*** ** * ** ***

Dynamic types for platform health sources.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources.DynamicHeartRateAccuracy : https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` Dynamic heart rate sensor accuracy value. |
| `class https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources.Keys` Data sources keys for platform health sources. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources#HEART_RATE_ACCURACY_HIGH() = 5` Heart rate data is available with high accuracy. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources#HEART_RATE_ACCURACY_LOW() = 3` Heart rate data is available but the accuracy is low. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources#HEART_RATE_ACCURACY_MEDIUM() = 4` Heart rate data is available and the accuracy is medium. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources#HEART_RATE_ACCURACY_NO_CONTACT() = 1` Heart rate cannot be acquired because the sensor is not properly contacting skin. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources#HEART_RATE_ACCURACY_UNKNOWN() = 0` Heart rate accuracy is unknown. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources#HEART_RATE_ACCURACY_UNRELIABLE() = 2` Heart rate data is currently too unreliable to be used. |

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(value = https://developer.android.com/reference/android/Manifest.permission.html#ACTIVITY_RECOGNITION) @https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources#dailyCalories()()` Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` which receives the current daily calories from platform health sources. |
| `java-static https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(value = https://developer.android.com/reference/android/Manifest.permission.html#ACTIVITY_RECOGNITION) @https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources#dailyDistanceMeters()()` Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` which receives the current daily distance expressed in meters from platform health sources. |
| `java-static https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(value = https://developer.android.com/reference/android/Manifest.permission.html#ACTIVITY_RECOGNITION) @https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources#dailyFloors()()` Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` which receives the current daily floors from platform health sources. |
| `java-static https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(value = https://developer.android.com/reference/android/Manifest.permission.html#ACTIVITY_RECOGNITION) @https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources#dailySteps()()` Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` which receives the current daily steps from platform health sources. |
| `java-static https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources.DynamicHeartRateAccuracy` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(anyOf = [https://developer.android.com/reference/android/Manifest.permission.html#BODY_SENSORS, https://developer.android.com/reference/android/health/connect/HealthPermissions.html#READ_HEART_RATE]) @https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources#heartRateAccuracy()()` Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources.DynamicHeartRateAccuracy` which receives the current heat rate sensor accuracy from platform sources. |
| `java-static https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(anyOf = [https://developer.android.com/reference/android/Manifest.permission.html#BODY_SENSORS, https://developer.android.com/reference/android/health/connect/HealthPermissions.html#READ_HEART_RATE]) @https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources#heartRateBpm()()` Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` which receives the current heat rate from platform sources. |

## Constants

### HEART_RATE_ACCURACY_HIGH

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
const val HEART_RATE_ACCURACY_HIGH = 5: Int
```

Heart rate data is available with high accuracy.

### HEART_RATE_ACCURACY_LOW

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
const val HEART_RATE_ACCURACY_LOW = 3: Int
```

Heart rate data is available but the accuracy is low.

### HEART_RATE_ACCURACY_MEDIUM

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
const val HEART_RATE_ACCURACY_MEDIUM = 4: Int
```

Heart rate data is available and the accuracy is medium.

### HEART_RATE_ACCURACY_NO_CONTACT

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
const val HEART_RATE_ACCURACY_NO_CONTACT = 1: Int
```

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

### HEART_RATE_ACCURACY_UNKNOWN

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
const val HEART_RATE_ACCURACY_UNKNOWN = 0: Int
```

Heart rate accuracy is unknown.

### HEART_RATE_ACCURACY_UNRELIABLE

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
const val HEART_RATE_ACCURACY_UNRELIABLE = 2: Int
```

Heart rate data is currently too unreliable to be used.

## Public functions

### dailyCalories

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresPermission(value = Manifest.permission.ACTIVITY_RECOGNITION)
@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun dailyCalories(): DynamicBuilders.DynamicFloat
```

Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` which receives the current daily calories from platform health sources. This is the total number of calories over a day (including both BMR and active calories) and it resets when 00:00 is reached (in whatever is the timezone set at that time). This can result in the DAILY period being greater than or less than 24 hours when the timezone of the device is changed.

### dailyDistanceMeters

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresPermission(value = Manifest.permission.ACTIVITY_RECOGNITION)
@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun dailyDistanceMeters(): DynamicBuilders.DynamicFloat
```

Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` which receives the current daily distance expressed in meters from platform health sources. This is the total distance over a day and it resets when 00:00 is reached (in whatever is the timezone set at that time). This can result in the DAILY period being greater than or less than 24 hours when the timezone of the device is changed.

### dailyFloors

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresPermission(value = Manifest.permission.ACTIVITY_RECOGNITION)
@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun dailyFloors(): DynamicBuilders.DynamicFloat
```

Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` which receives the current daily floors from platform health sources. This is the total number of floors climbed over a day and it resets when 00:00 is reached (in whatever is the timezone set at that time). This can result in the DAILY period being greater than or less than 24 hours when the timezone of the device is changed.

### dailySteps

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresPermission(value = Manifest.permission.ACTIVITY_RECOGNITION)
@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun dailySteps(): DynamicBuilders.DynamicInt32
```

Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` which receives the current daily steps from platform health sources. This is the total step count over a day and it resets when 00:00 is reached (in whatever is the timezone set at that time). This can result in the DAILY period being greater than or less than 24 hours when the timezone of the device is changed.

This method provides backward compatibility and is preferred over using `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources.Keys#DAILY_STEPS()` directly.

### heartRateAccuracy

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresPermission(anyOf = [Manifest.permission.BODY_SENSORS, HealthPermissions.READ_HEART_RATE])
@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun heartRateAccuracy(): PlatformHealthSources.DynamicHeartRateAccuracy
```

Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources.DynamicHeartRateAccuracy` which receives the current heat rate sensor accuracy from platform sources.

The accuracy value is one of `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources.DynamicHeartRateAccuracy` constants.

Requirements:

- API \<36: `https://developer.android.com/reference/android/Manifest.permission.html#BODY_SENSORS`
- API \>= 36: `https://developer.android.com/reference/android/health/connect/HealthPermissions.html#READ_HEART_RATE`

### heartRateBpm

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresPermission(anyOf = [Manifest.permission.BODY_SENSORS, HealthPermissions.READ_HEART_RATE])
@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun heartRateBpm(): DynamicBuilders.DynamicFloat
```

Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicFloat` which receives the current heat rate from platform sources.

This method provides backward compatibility and is preferred over using `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/PlatformHealthSources.Keys#HEART_RATE_BPM()` directly.

Requirements:

- API \<36: `https://developer.android.com/reference/android/Manifest.permission.html#BODY_SENSORS`
- API \>= 36: `https://developer.android.com/reference/android/health/connect/HealthPermissions.html#READ_HEART_RATE`