Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public interface WorkoutSessionListener

Receives workout lifecycle and statistics updates. All callbacks arrive on the EDT.

Methods

public abstract void workoutStateChanged(WorkoutSession session, WorkoutSessionState state)The session moved to a new state.
public abstract void workoutStatisticsUpdated(WorkoutSession session, HealthDataType type)A live statistic changed.
public abstract void workoutEvent(WorkoutSession session, WorkoutEvent event)An event was recorded, whether by the app or detected by the platform.
public abstract void workoutFailed(WorkoutSession session, HealthException error)The session failed and will not continue.

Method details

workoutStateChanged

public abstract void workoutStateChanged(WorkoutSession session, WorkoutSessionState state)

The session moved to a new state.

Every transition is one the app asked for in this release, since recorded sessions are the only kind here. The callback exists for the unrequested ones a live session brings – watchOS ends one when the wearer starts another workout – so that code written against it keeps working when that arrives.

workoutStatisticsUpdated

public abstract void workoutStatisticsUpdated(WorkoutSession session, HealthDataType type)

workoutEvent

public abstract void workoutEvent(WorkoutSession session, WorkoutEvent event)
An event was recorded, whether by the app or detected by the platform.

workoutFailed

public abstract void workoutFailed(WorkoutSession session, HealthException error)
The session failed and will not continue.