public enum WorkoutSessionState

  1. Object
  2. Enum<WorkoutSessionState>
  3. WorkoutSessionState

ImplementsComparable<WorkoutSessionState>

The lifecycle of a WorkoutSession.

Transitions are enforced: calling a method that does not apply to the current state fails with HealthError.SESSION_STATE rather than silently doing nothing or throwing.

Enum constants

NOT_STARTEDCreated but not yet prepared or started.
PREPARINGSensors are warming up.
RUNNINGRecording.
PAUSEDPaused.
STOPPEDStopping: collection has ceased but the workout has not been written yet.
ENDEDEnded and persisted.
FAILEDEnded in error, or discarded.

Methods

public static WorkoutSessionState[] values()
public static WorkoutSessionState valueOf(String name)

Inherited methods

Enum constant details

NOT_STARTED

NOT_STARTED
Created but not yet prepared or started.

PREPARING

PREPARING
Sensors are warming up. Optional – see WorkoutSession.prepare() – and worth using if you show a countdown, because heart rate is not immediately available when a session begins.

RUNNING

RUNNING
Recording.

PAUSED

PAUSED
Paused. The elapsed clock stops; wall-clock time keeps passing and is excluded from WorkoutSession.getElapsedMillis().

STOPPED

STOPPED
Stopping: collection has ceased but the workout has not been written yet.

ENDED

ENDED
Ended and persisted.

FAILED

FAILED
Ended in error, or discarded.

Method details

values

public static WorkoutSessionState[] values()

valueOf

public static WorkoutSessionState valueOf(String name)