ExerciseUpdateCallback


interface ExerciseUpdateCallback


Callback that is called when the state of the current exercise is updated.

Summary

Public functions

Unit
onAvailabilityChanged(
    dataType: DataType<*, *>,
    availability: Availability
)

Called during an ExerciseState.ACTIVE exercise when the availability of a DataType changes.

open Unit

Called when an ExerciseEvent is emitted.

Unit

Called during an ACTIVE exercise or on any changes in ExerciseState.

Unit

Called during an ExerciseState.ACTIVE exercise once a lap has been marked.

Unit

Called when this callback has been successfully registered with Health Services.

Unit

Called when Health Services reports a failure with the registration of this callback.

Public functions

onAvailabilityChanged

Added in 1.0.0
fun onAvailabilityChanged(
    dataType: DataType<*, *>,
    availability: Availability
): Unit

Called during an ExerciseState.ACTIVE exercise when the availability of a DataType changes.

Parameters
dataType: DataType<*, *>

the DataType which experienced a change in availability

availability: Availability

the new Availability state

onExerciseEventReceived

Added in 1.1.0-alpha02
open fun onExerciseEventReceived(event: ExerciseEvent): Unit

Called when an ExerciseEvent is emitted. May be called during any exercise state except for PREPARING or ENDED.

Parameters
event: ExerciseEvent

the latest ExerciseEvent received during an active exercise. To access the data for each received ExerciseEvent, clients can use conditional when on ExerciseEvent for a specific event type to access the event-specific data.

onExerciseUpdateReceived

Added in 1.0.0
fun onExerciseUpdateReceived(update: ExerciseUpdate): Unit

Called during an ACTIVE exercise or on any changes in ExerciseState.

Parameters
update: ExerciseUpdate

the ExerciseUpdate containing the latest exercise information

onLapSummaryReceived

Added in 1.0.0
fun onLapSummaryReceived(lapSummary: ExerciseLapSummary): Unit

Called during an ExerciseState.ACTIVE exercise once a lap has been marked.

Parameters
lapSummary: ExerciseLapSummary

an ExerciseLapSummary containing a summary of data collected during the past lap

onRegistered

Added in 1.0.0
fun onRegistered(): Unit

Called when this callback has been successfully registered with Health Services.

onRegistrationFailed

Added in 1.0.0
fun onRegistrationFailed(throwable: Throwable): Unit

Called when Health Services reports a failure with the registration of this callback.

Parameters
throwable: Throwable

a throwable sent by Health Services with information about the failure