# ExerciseUpdateCallback

Artifact: [androidx.health:health-services-client](https://developer.android.com/jetpack/androidx/releases/health) [View Source](https://cs.android.com/search?q=file:androidx/health/services/client/ExerciseUpdateCallback.kt+class:androidx.health.services.client.ExerciseUpdateCallback) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

*** ** * ** ***


```
public interface ExerciseUpdateCallback
```

<br />

*** ** * ** ***

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

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/health/services/client/ExerciseUpdateCallback#onAvailabilityChanged(androidx.health.services.client.data.DataType,androidx.health.services.client.data.Availability)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/DataType<@https://developer.android.com/reference/androidx/annotation/NonNull ?, @https://developer.android.com/reference/androidx/annotation/NonNull ?> dataType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/Availability availability )` Called during an `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseState#ACTIVE()` exercise when the availability of a `https://developer.android.com/reference/androidx/health/services/client/data/DataType` changes. |
| `default void` | `https://developer.android.com/reference/androidx/health/services/client/ExerciseUpdateCallback#onExerciseEventReceived(androidx.health.services.client.data.ExerciseEvent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseEvent event)` Called when an `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseEvent` is emitted. |
| `abstract void` | `https://developer.android.com/reference/androidx/health/services/client/ExerciseUpdateCallback#onExerciseUpdateReceived(androidx.health.services.client.data.ExerciseUpdate)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseUpdate update)` Called during an ACTIVE exercise or on any changes in `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseState`. |
| `abstract void` | `https://developer.android.com/reference/androidx/health/services/client/ExerciseUpdateCallback#onLapSummaryReceived(androidx.health.services.client.data.ExerciseLapSummary)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseLapSummary lapSummary)` Called during an `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseState#ACTIVE()` exercise once a lap has been marked. |
| `abstract void` | `https://developer.android.com/reference/androidx/health/services/client/ExerciseUpdateCallback#onRegistered()()` Called when this callback has been successfully registered with Health Services. |
| `abstract void` | `https://developer.android.com/reference/androidx/health/services/client/ExerciseUpdateCallback#onRegistrationFailed(kotlin.Throwable)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Throwable.html throwable)` Called when Health Services reports a failure with the registration of this callback. |

## Public methods

### onAvailabilityChanged

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
abstract void onAvailabilityChanged(
    @NonNull DataType<@NonNull ?, @NonNull ?> dataType,
    @NonNull Availability availability
)
```

Called during an `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseState#ACTIVE()` exercise when the availability of a `https://developer.android.com/reference/androidx/health/services/client/data/DataType` changes.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/DataType<@https://developer.android.com/reference/androidx/annotation/NonNull ?, @https://developer.android.com/reference/androidx/annotation/NonNull ?> dataType` | the `https://developer.android.com/reference/androidx/health/services/client/data/DataType` which experienced a change in availability |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/Availability availability` | the new `https://developer.android.com/reference/androidx/health/services/client/data/Availability` state |

### onExerciseEventReceived

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health#1.1.0)

```
default void onExerciseEventReceived(@NonNull ExerciseEvent event)
```

Called when an `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseEvent` is emitted. May be called during any exercise state except for PREPARING or ENDED.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseEvent event` | the latest `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseEvent` received during an active exercise. To access the data for each received `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseEvent`, clients can use conditional `when` on `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseEvent` for a specific event type to access the event-specific data. |

### onExerciseUpdateReceived

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
abstract void onExerciseUpdateReceived(@NonNull ExerciseUpdate update)
```

Called during an ACTIVE exercise or on any changes in `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseState`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseUpdate update` | the `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseUpdate` containing the latest exercise information |

### onLapSummaryReceived

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
abstract void onLapSummaryReceived(@NonNull ExerciseLapSummary lapSummary)
```

Called during an `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseState#ACTIVE()` exercise once a lap has been marked.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseLapSummary lapSummary` | an `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseLapSummary` containing a summary of data collected during the past lap |

### onRegistered

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
abstract void onRegistered()
```

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

### onRegistrationFailed

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
abstract void onRegistrationFailed(@NonNull Throwable throwable)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Throwable.html throwable` | a throwable sent by Health Services with information about the failure |