# ExerciseUpdate

Artifact: [androidx.health:health-services-client](https://developer.android.com/jetpack/androidx/releases/health) [View Source](https://cs.android.com/search?q=file:androidx/health/services/client/data/ExerciseUpdate.kt+class:androidx.health.services.client.data.ExerciseUpdate) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

*** ** * ** ***


```
class ExerciseUpdate
```

<br />

*** ** * ** ***

Contains the latest updated state and metrics for the current exercise.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate.ActiveDurationCheckpoint` This records the last time the exercise transitioned from an active to an inactive state or from an inactive to an active state, where inactive states match those found in `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseState#isPaused()` or `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseState#isEnded()`. |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://developer.android.com/reference/java/time/Duration.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#getActiveDurationAtDataPoint(androidx.health.services.client.data.IntervalDataPoint)(dataPoint: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/IntervalDataPoint<*>)` Returns the ActiveDuration of the exercise at the time of the provided `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/IntervalDataPoint`. |
| `https://developer.android.com/reference/java/time/Duration.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#getActiveDurationAtDataPoint(androidx.health.services.client.data.SampleDataPoint)(dataPoint: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/SampleDataPoint<*>)` Returns the ActiveDuration of the exercise at the time of the provided `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/SampleDataPoint`. |
| `https://developer.android.com/reference/java/time/Duration.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#getUpdateDurationFromBoot()()` Returns the duration since boot when this ExerciseUpdate was created. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#toString()()` |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate.ActiveDurationCheckpoint?` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#activeDurationCheckpoint()` Returns the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate.ActiveDurationCheckpoint` which can be used to determine the active duration of the exercise in a way that is consistent with Health Services. |
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseConfig?` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#exerciseConfig()` Returns the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseConfig` used by the exercise when the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate` was dispatched and returns `null` if the exercise is in prepare phase and hasn't been started yet. |
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseStateInfo` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#exerciseStateInfo()` Returns the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseStateInfo` containing the current `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseState` and `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseEndReason`, if applicable. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-number/index.html>>` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#latestAchievedDebouncedGoals()` Returns the latest `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal`s that have been achieved. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-number/index.html>>` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#latestAchievedGoals()` Returns the latest `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal`s that have been achieved. |
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataPointContainer` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#latestMetrics()` Returns the list of the latest `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataPoint`s. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/kotlin/androidx/health/services/client/data/MilestoneMarkerSummary>` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#latestMilestoneMarkerSummaries()` Returns the latest `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/MilestoneMarkerSummary`s. |
| `https://developer.android.com/reference/java/time/Instant.html?` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#startTime()` Returns the time at which the exercise was started or `null` if the exercise is in prepare phase and hasn't started yet. |

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### getActiveDurationAtDataPoint

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

```
fun getActiveDurationAtDataPoint(dataPoint: IntervalDataPoint<*>): Duration
```

Returns the ActiveDuration of the exercise at the time of the provided `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/IntervalDataPoint`. The provided `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/IntervalDataPoint` should be present in this `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#getActiveDurationAtDataPoint(androidx.health.services.client.data.IntervalDataPoint)` is not present in this `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if this `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate` does not contain a valid `updateDurationFromBoot` which may happen if the Health Services app is out of date |

### getActiveDurationAtDataPoint

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

```
fun getActiveDurationAtDataPoint(dataPoint: SampleDataPoint<*>): Duration
```

Returns the ActiveDuration of the exercise at the time of the provided `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/SampleDataPoint`. The provided `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/SampleDataPoint` should be present in this `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#getActiveDurationAtDataPoint(androidx.health.services.client.data.SampleDataPoint)` is not present in this `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate` |

### getUpdateDurationFromBoot

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

```
fun getUpdateDurationFromBoot(): Duration
```

Returns the duration since boot when this ExerciseUpdate was created.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if this `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate` does not contain a valid `updateDurationFromBoot` which may happen if the Health Services app is out of date |

### hashCode

```
open fun hashCode(): Int
```

### toString

```
open fun toString(): String
```

## Public properties

### activeDurationCheckpoint

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

```
val activeDurationCheckpoint: ExerciseUpdate.ActiveDurationCheckpoint?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate.ActiveDurationCheckpoint` which can be used to determine the active duration of the exercise in a way that is consistent with Health Services. Clients can anchor their application timers against this to ensure their view of the active duration matches the view of Health Services.

### exerciseConfig

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

```
val exerciseConfig: ExerciseConfig?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseConfig` used by the exercise when the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate` was dispatched and returns `null` if the exercise is in prepare phase and hasn't been started yet.

### exerciseStateInfo

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

```
val exerciseStateInfo: ExerciseStateInfo
```

Returns the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseStateInfo` containing the current `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseState` and `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseEndReason`, if applicable.

### latestAchievedDebouncedGoals

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health#1.1.0)

```
val latestAchievedDebouncedGoals: Set<DebouncedGoal<Number>>
```

Returns the latest `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal`s that have been achieved.

### latestAchievedGoals

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

```
val latestAchievedGoals: Set<ExerciseGoal<Number>>
```

Returns the latest `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal`s that have been achieved. `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal`s will be returned via `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate#(androidx.health.services.client.data.DataPointContainer,kotlin.collections.Set,kotlin.collections.Set,androidx.health.services.client.data.ExerciseStateInfo,androidx.health.services.client.data.ExerciseConfig,androidx.health.services.client.data.ExerciseUpdate.ActiveDurationCheckpoint,java.time.Duration,java.time.Instant,java.time.Duration,kotlin.collections.Set)`.

### latestMetrics

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

```
val latestMetrics: DataPointContainer
```

Returns the list of the latest `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataPoint`s.

### latestMilestoneMarkerSummaries

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

```
val latestMilestoneMarkerSummaries: Set<MilestoneMarkerSummary>
```

Returns the latest `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/MilestoneMarkerSummary`s.

### startTime

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

```
val startTime: Instant?
```

Returns the time at which the exercise was started or `null` if the exercise is in prepare phase and hasn't started yet.