ExerciseUpdate.ActiveDurationCheckpoint


public final class 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 ExerciseState.isPaused or ExerciseState.isEnded. This can be used to calculate the exercise active duration in a way that is consistent with Health Service's view of the exercise.

If the exercise is currently inactive, the exercise’s active duration will match activeDuration below. If the exercise is active, the active duration can be calculated by activeDuration + (now() - time).

Summary

Public constructors

ActiveDurationCheckpoint(
    @NonNull Instant time,
    @NonNull Duration activeDuration
)

Public methods

boolean
equals(Object other)
final @NonNull Duration

Returns the active duration of the exercise at the time it last transitioned to "active", or the duration when it transitioned to inactive if it's currently paused or stopped.

final @NonNull Instant

Returns the time at which the exercise last transitioned between the active or inactive states.

int
@NonNull String

Public constructors

ActiveDurationCheckpoint

Added in 1.0.0
public ActiveDurationCheckpoint(
    @NonNull Instant time,
    @NonNull Duration activeDuration
)

Public methods

equals

public boolean equals(Object other)

getActiveDuration

Added in 1.0.0
public final @NonNull Duration getActiveDuration()

Returns the active duration of the exercise at the time it last transitioned to "active", or the duration when it transitioned to inactive if it's currently paused or stopped.

getTime

Added in 1.0.0
public final @NonNull Instant getTime()

Returns the time at which the exercise last transitioned between the active or inactive states.

hashCode

public int hashCode()

toString

public @NonNull String toString()