ExerciseUpdate

class ExerciseUpdate


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

Summary

Nested types

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 ExerciseState.isPaused or ExerciseState.isEnded.

Public functions

open operator Boolean
equals(other: Any?)
Duration

Returns the ActiveDuration of the exercise at the time of the provided IntervalDataPoint.

Duration

Returns the ActiveDuration of the exercise at the time of the provided SampleDataPoint.

Duration

Returns the duration since boot when this ExerciseUpdate was created.

open Int
open String

Public properties

ExerciseUpdate.ActiveDurationCheckpoint?

Returns the ActiveDurationCheckpoint which can be used to determine the active duration of the exercise in a way that is consistent with Health Services.

ExerciseConfig?

Returns the ExerciseConfig used by the exercise when the ExerciseUpdate was dispatched and returns null if the exercise is in prepare phase and hasn't been started yet.

ExerciseStateInfo

Returns the ExerciseStateInfo containing the current ExerciseState and ExerciseEndReason, if applicable.

Set<ExerciseGoal<Number>>

Returns the latest ExerciseGoalType.ONE_TIME_GOALs that have been achieved.

DataPointContainer

Returns the list of the latest DataPoints.

Set<MilestoneMarkerSummary>

Returns the latest MilestoneMarkerSummarys.

Instant?

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
fun getActiveDurationAtDataPoint(dataPoint: IntervalDataPoint<*>): Duration

Returns the ActiveDuration of the exercise at the time of the provided IntervalDataPoint. The provided IntervalDataPoint should be present in this ExerciseUpdate.

Throws
kotlin.IllegalArgumentException

if dataPoint is not present in this ExerciseUpdate

kotlin.IllegalStateException

if this 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
fun getActiveDurationAtDataPoint(dataPoint: SampleDataPoint<*>): Duration

Returns the ActiveDuration of the exercise at the time of the provided SampleDataPoint. The provided SampleDataPoint should be present in this ExerciseUpdate.

Throws
kotlin.IllegalArgumentException

if dataPoint is not present in this ExerciseUpdate

getUpdateDurationFromBoot

Added in 1.0.0
fun getUpdateDurationFromBoot(): Duration

Returns the duration since boot when this ExerciseUpdate was created.

Throws
kotlin.IllegalStateException

if this 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
val activeDurationCheckpointExerciseUpdate.ActiveDurationCheckpoint?

Returns the 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
val exerciseConfigExerciseConfig?

Returns the ExerciseConfig used by the exercise when the 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
val exerciseStateInfoExerciseStateInfo

Returns the ExerciseStateInfo containing the current ExerciseState and ExerciseEndReason, if applicable.

latestAchievedGoals

Added in 1.0.0
val latestAchievedGoalsSet<ExerciseGoal<Number>>

Returns the latest ExerciseGoalType.ONE_TIME_GOALs that have been achieved. ExerciseGoalType.MILESTONEs will be returned via latestMilestoneMarkerSummaries.

latestMetrics

Added in 1.0.0
val latestMetricsDataPointContainer

Returns the list of the latest DataPoints.

latestMilestoneMarkerSummaries

Added in 1.0.0
val latestMilestoneMarkerSummariesSet<MilestoneMarkerSummary>

Returns the latest MilestoneMarkerSummarys.

startTime

Added in 1.0.0
val startTimeInstant?

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