Interface WorkoutSessionListener
public interface WorkoutSessionListener
Receives workout lifecycle and statistics updates. All callbacks arrive
on the EDT.
-
Method Summary
Modifier and TypeMethodDescriptionvoidworkoutEvent(WorkoutSession session, WorkoutEvent event) An event was recorded, whether by the app or detected by the platform.voidworkoutFailed(WorkoutSession session, HealthException error) The session failed and will not continue.voidworkoutStateChanged(WorkoutSession session, WorkoutSessionState state) The session moved to a new state.voidworkoutStatisticsUpdated(WorkoutSession session, HealthDataType type) A live statistic changed.
-
Method Details
-
workoutStateChanged
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
A live statistic changed. Read the new value with WorkoutSession#getStatistic(HealthDataType, com.codename1.health.AggregateMetric). -
workoutEvent
An event was recorded, whether by the app or detected by the platform. -
workoutFailed
The session failed and will not continue.
-