# MeasureCallback

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/MeasureCallback.kt+class:androidx.health.services.client.MeasureCallback) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

*** ** * ** ***


```
public interface MeasureCallback
```

<br />

*** ** * ** ***

Callback for `https://developer.android.com/reference/androidx/health/services/client/MeasureClient#registerMeasureCallback(androidx.health.services.client.data.DeltaDataType,androidx.health.services.client.MeasureCallback)`.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/health/services/client/MeasureCallback#onAvailabilityChanged(androidx.health.services.client.data.DeltaDataType,androidx.health.services.client.data.Availability)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/DeltaDataType<@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 when the availability of a `https://developer.android.com/reference/androidx/health/services/client/data/DataType` changes. |
| `abstract void` | `https://developer.android.com/reference/androidx/health/services/client/MeasureCallback#onDataReceived(androidx.health.services.client.data.DataPointContainer)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/DataPointContainer data)` Called when new data is available. |
| `default void` | `https://developer.android.com/reference/androidx/health/services/client/MeasureCallback#onRegistered()()` Called when this callback has been successfully registered with Health Services. |
| `default void` | `https://developer.android.com/reference/androidx/health/services/client/MeasureCallback#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 DeltaDataType<@NonNull ?, @NonNull ?> dataType,
    @NonNull Availability availability
)
```

Called 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/DeltaDataType<@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/DeltaDataType` that 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` status for this `https://developer.android.com/reference/androidx/health/services/client/MeasureCallback#onAvailabilityChanged(androidx.health.services.client.data.DeltaDataType,androidx.health.services.client.data.Availability)` |

### onDataReceived

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

```
abstract void onDataReceived(@NonNull DataPointContainer data)
```

Called when new data is available. Data may be batched.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/DataPointContainer data` | the (potentially batched) set of measured `https://developer.android.com/reference/androidx/health/services/client/data/DataPoint`s corresponding to one or more of the requested `https://developer.android.com/reference/androidx/health/services/client/data/DeltaDataType`s |

### onRegistered

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

```
default 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)

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

Called when Health Services reports a failure with the registration of this callback. Common causes include: the calling app lacks the necessary permission, or the device does not support the requested `https://developer.android.com/reference/androidx/health/services/client/data/DataType`.

| 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 |