# androidx.health.services.client

*** ** * ** ***

## Interfaces

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient` | Client which provides a way to subscribe to the health data of a device during an exercise. |
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback` | Callback that is called when the state of the current exercise is updated. |
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesClient` | Client which provides a way to subscribe to the health data of a device, in the background or in the foreground. |
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/MeasureCallback` | Callback for `https://developer.android.com/reference/kotlin/androidx/health/services/client/MeasureClient#registerMeasureCallback(androidx.health.services.client.data.DeltaDataType,androidx.health.services.client.MeasureCallback)`. |
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/MeasureClient` | Client which provides a way to make measurements of health data on a device. |
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveListenerCallback` | A callback for receiving passive monitoring updates. |
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveMonitoringClient` | Client which provides a means to passively monitor data without requiring an ongoing workout. |

## Classes

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveListenerService` | Service that enables receiving passive monitoring updates throughout the day when the app may not be running. |

## Exceptions

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | Exception class for all the Health Services errors. |

## Objects

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServices` | Entry point for all Health Services APIs. |

## Extension functions summary

|---|---|
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).addDebouncedGoalToActiveExercise(androidx.health.services.client.data.DebouncedGoal)( debouncedGoal: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal<*> )` Adds a `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal` for an active exercise. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).addGoalToActiveExercise(androidx.health.services.client.data.ExerciseGoal)(exerciseGoal: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal<*>)` Adds an `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal` for an active exercise. |
| `suspend T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<T>.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(com.google.common.util.concurrent.ListenableFuture).awaitWithException()()` Extension function on ListenableFuture performs `https://developer.android.com/reference/kotlin/androidx/concurrent/futures/package-summary#(com.google.common.util.concurrent.ListenableFuture).await()` operation and if any exception thrown by the asynchronous API, converts `https://developer.android.com/reference/android/os/RemoteException.html` into `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveMonitoringClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.PassiveMonitoringClient).clearPassiveListenerCallback()()` Unregisters the subscription made by `https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerCallback(androidx.health.services.client.data.PassiveListenerConfig,androidx.health.services.client.PassiveListenerCallback)`. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveMonitoringClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.PassiveMonitoringClient).clearPassiveListenerService()()` Unregisters the subscription made by `https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.PassiveMonitoringClient).setPassiveListenerService(java.lang.Class,androidx.health.services.client.data.PassiveListenerConfig)`. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).clearUpdateCallback(androidx.health.services.client.ExerciseUpdateCallback)(callback: https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback)` Clears the callback set using `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient#setUpdateCallback(androidx.health.services.client.ExerciseUpdateCallback)`. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).endExercise()()` Ends the current exercise, if it has been started. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).flush()()` Flushes the sensors for the active exercise. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveMonitoringClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.PassiveMonitoringClient).flush()()` Flushes the sensors for the registered `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType`s. |
| `suspend https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseCapabilities` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).getCapabilities()()` Returns the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseCapabilities` of this client for the device. |
| `suspend https://developer.android.com/reference/kotlin/androidx/health/services/client/data/MeasureCapabilities` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/MeasureClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.MeasureClient).getCapabilities()()` Returns the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/MeasureCapabilities` of this client for the device. |
| `suspend https://developer.android.com/reference/kotlin/androidx/health/services/client/data/PassiveMonitoringCapabilities` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveMonitoringClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.PassiveMonitoringClient).getCapabilities()()` Returns the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/PassiveMonitoringCapabilities` of this client for this device. |
| `suspend https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseInfo` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).getCurrentExerciseInfo()()` Returns the current `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseInfo`. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).markLap()()` Ends the current lap, calls `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback#onLapSummaryReceived(androidx.health.services.client.data.ExerciseLapSummary)` with data spanning the marked lap and starts a new lap. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).overrideAutoPauseAndResumeForActiveExercise(kotlin.Boolean)( enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Enables or disables auto pause/resume for the current exercise. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).overrideBatchingModesForActiveExercise(kotlin.collections.Set)( batchingModes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/kotlin/androidx/health/services/client/data/BatchingMode> )` Sets the batching mode for the current exercise synchronously. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).pauseExercise()()` Pauses the current exercise, if it is currently started. |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).prepareExercise(androidx.health.services.client.data.WarmUpConfig)(configuration: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/WarmUpConfig)` Prepares for a new exercise. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).removeDebouncedGoalFromActiveExercise(androidx.health.services.client.data.DebouncedGoal)( debouncedGoal: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal<*> )` Removes a debounced goal from an active exercise. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).removeGoalFromActiveExercise(androidx.health.services.client.data.ExerciseGoal)( exerciseGoal: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal<*> )` Removes an exercise goal for an active exercise. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).resumeExercise()()` Resumes the current exercise, if it is currently paused. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveMonitoringClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.PassiveMonitoringClient).setPassiveListenerService(java.lang.Class,androidx.health.services.client.data.PassiveListenerConfig)( service: https://developer.android.com/reference/java/lang/Class.html<https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveListenerService>, config: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/PassiveListenerConfig )` Subscribes for updates to be periodically delivered to the app. |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).startExercise(androidx.health.services.client.data.ExerciseConfig)(configuration: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseConfig)` Starts a new exercise. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/MeasureClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.MeasureClient).unregisterMeasureCallback(androidx.health.services.client.data.DeltaDataType,androidx.health.services.client.MeasureCallback)( dataType: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DeltaDataType<*, *>, callback: https://developer.android.com/reference/kotlin/androidx/health/services/client/MeasureCallback )` Unregisters the given `https://developer.android.com/reference/kotlin/androidx/health/services/client/MeasureCallback` for updates of the given `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DeltaDataType`. |
| `suspend https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient.https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).updateExerciseTypeConfig(androidx.health.services.client.data.ExerciseTypeConfig)( exerciseTypeConfig: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseTypeConfig )` Updates the configurable exercise type attributes for the current exercise. |

## Extension functions

### ExerciseClient.addDebouncedGoalToActiveExercise

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/ExerciseClientExtension.kt+function:addDebouncedGoalToActiveExercise)

```
suspend fun ExerciseClient.addDebouncedGoalToActiveExercise(
    debouncedGoal: DebouncedGoal<*>
): Void
```

Adds a `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal` for an active exercise.

`https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal`s apply to only sample data types (e.g. HeartRate, Speed) for active exercises owned by the client, and will be invalidated once the exercise is complete. Note: To add goals for Cumulative DataTypes (i.e. steps, distance...) please see `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient#addGoalToActiveExerciseAsync(androidx.health.services.client.data.ExerciseGoal)`.

Before adding, `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal` should be checked for support against ExerciseTypeCapabilities.supportedDebouncedGoals. Only one `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal` is allowed per `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType`+ComparisonType pair.

| Parameters |
|---|---|
| `debouncedGoal: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal<*>` | the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal` to add to this exercise |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### ExerciseClient.addGoalToActiveExercise

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/ExerciseClientExtension.kt+function:addGoalToActiveExercise)

```
suspend fun ExerciseClient.addGoalToActiveExercise(exerciseGoal: ExerciseGoal<*>): Void
```

Adds an `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal` for an active exercise.

Goals apply to only active exercises owned by the client, and will be invalidated once the exercise is complete.

| Parameters |
|---|---|
| `exerciseGoal: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal<*>` | the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal` to add to this exercise |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### ListenableFuture.awaitWithException

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/ListenableFutureExtension.kt+function:awaitWithException)

```
suspend fun <T : Any?> ListenableFuture<T>.awaitWithException(): T
```

Extension function on ListenableFuture performs `https://developer.android.com/reference/kotlin/androidx/concurrent/futures/package-summary#(com.google.common.util.concurrent.ListenableFuture).await()` operation and if any exception thrown by the asynchronous API, converts `https://developer.android.com/reference/android/os/RemoteException.html` into `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException`

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if remote operation fails |

### PassiveMonitoringClient.clearPassiveListenerCallback

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/PassiveMonitoringClientExtension.kt+function:clearPassiveListenerCallback)

```
suspend fun PassiveMonitoringClient.clearPassiveListenerCallback(): Void
```

Unregisters the subscription made by `https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerCallback(androidx.health.services.client.data.PassiveListenerConfig,androidx.health.services.client.PassiveListenerCallback)`.

Data will not be delivered after this call so if clients care about any pending batched data they should call flush before unregistering.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### PassiveMonitoringClient.clearPassiveListenerService

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/PassiveMonitoringClientExtension.kt+function:clearPassiveListenerService)

```
suspend fun PassiveMonitoringClient.clearPassiveListenerService(): Void
```

Unregisters the subscription made by `https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.PassiveMonitoringClient).setPassiveListenerService(java.lang.Class,androidx.health.services.client.data.PassiveListenerConfig)`.

Data will not be delivered after this call so if clients care about any pending batched data they should call flush before unregistering.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### ExerciseClient.clearUpdateCallback

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/ExerciseClientExtension.kt+function:clearUpdateCallback)

```
suspend fun ExerciseClient.clearUpdateCallback(callback: ExerciseUpdateCallback): Void
```

Clears the callback set using `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient#setUpdateCallback(androidx.health.services.client.ExerciseUpdateCallback)`.

If this callback is not already registered then this will be a no-op.

| Parameters |
|---|---|
| `callback: https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback` | the `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback` to clear |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### ExerciseClient.endExercise

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/ExerciseClientExtension.kt+function:endExercise)

```
suspend fun ExerciseClient.endExercise(): Void
```

Ends the current exercise, if it has been started.

Health Services will flush and then shut down the active sensors and return an `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate` with `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseState#ENDED()` along with the reason `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseEndReason.Companion#USER_END()` to the `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback`. If the exercise has already ended then this call fails with a `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException`.

No additional metrics will be produced for the exercise and any on device persisted data about the exercise will be deleted after the summary has been sent back.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if exercise has already ended or if Health Service fails to process the call |

### ExerciseClient.flush

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/ExerciseClientExtension.kt+function:flush)

```
suspend fun ExerciseClient.flush(): Void
```

Flushes the sensors for the active exercise. This call should be used sparingly and will be subject to throttling by Health Services.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if the Health Service fails to process the request |

### PassiveMonitoringClient.flush

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/PassiveMonitoringClientExtension.kt+function:flush)

```
suspend fun PassiveMonitoringClient.flush(): Void
```

Flushes the sensors for the registered `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType`s.

If no listener has been registered by this client, this will be a no-op. This call should be used sparingly and will be subject to throttling by Health Services.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### ExerciseClient.getCapabilities

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/ExerciseClientExtension.kt+function:getCapabilities)

```
suspend fun ExerciseClient.getCapabilities(): ExerciseCapabilities
```

Returns the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseCapabilities` of this client for the device.

This can be used to determine what `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseType`s and `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType`s this device supports. Clients should use the capabilities to inform their requests since Health Services will typically reject requests made for `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType`s or features (such as auto-pause) which are not enabled for the rejected `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseType`.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseCapabilities` | a the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseCapabilities` for this device |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### MeasureClient.getCapabilities

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/MeasureClientExtension.kt+function:getCapabilities)

```
suspend fun MeasureClient.getCapabilities(): MeasureCapabilities
```

Returns the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/MeasureCapabilities` of this client for the device.

This can be used to determine what `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DeltaDataType`s this device supports for live measurement. Clients should use the capabilities to inform their requests since Health Services will typically reject requests made for `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DeltaDataType`s which are not enabled for measurement.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/MeasureCapabilities` | a `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/MeasureCapabilities` for this device |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### PassiveMonitoringClient.getCapabilities

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/PassiveMonitoringClientExtension.kt+function:getCapabilities)

```
suspend fun PassiveMonitoringClient.getCapabilities(): PassiveMonitoringCapabilities
```

Returns the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/PassiveMonitoringCapabilities` of this client for this device.

This can be used to determine what `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType`s this device supports for passive monitoring and goals. Clients should use the capabilities to inform their requests since Health Services will typically reject requests made for `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType`s which are not supported.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/PassiveMonitoringCapabilities` | a `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/PassiveMonitoringCapabilities` for this device |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### ExerciseClient.getCurrentExerciseInfo

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/ExerciseClientExtension.kt+function:getCurrentExerciseInfo)

```
suspend fun ExerciseClient.getCurrentExerciseInfo(): ExerciseInfo
```

Returns the current `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseInfo`.

This can be used by clients to determine if they or another app already owns an active exercise being tracked by Health Services. For example, if an app is killed and it learns it owns the active exercise it can register a new `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback` and pick tracking up from where it left off.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseInfo` | a `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseInfo` that contains information about the current exercise |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### ExerciseClient.markLap

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/ExerciseClientExtension.kt+function:markLap)

```
suspend fun ExerciseClient.markLap(): Void
```

Ends the current lap, calls `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback#onLapSummaryReceived(androidx.health.services.client.data.ExerciseLapSummary)` with data spanning the marked lap and starts a new lap. If the exercise supports laps this method can be called at any point after an exercise has been started and before it has been ended regardless of the exercise status.

The metrics in the lap summary will start from either the start time of the exercise or the last time a lap was marked to the time this method is being called.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | If there's no exercise being tracked or if Health Service fails to process the call |

### ExerciseClient.overrideAutoPauseAndResumeForActiveExercise

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/ExerciseClientExtension.kt+function:overrideAutoPauseAndResumeForActiveExercise)

```
suspend fun ExerciseClient.overrideAutoPauseAndResumeForActiveExercise(
    enabled: Boolean
): Void
```

Enables or disables auto pause/resume for the current exercise.

| Parameters |
|---|---|
| `enabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | a boolean to indicate if should be enabled or disabled |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### ExerciseClient.overrideBatchingModesForActiveExercise

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/ExerciseClientExtension.kt+function:overrideBatchingModesForActiveExercise)

```
suspend fun ExerciseClient.overrideBatchingModesForActiveExercise(
    batchingModes: Set<BatchingMode>
): Void
```

Sets the batching mode for the current exercise synchronously.

| Parameters |
|---|---|
| `batchingModes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://developer.android.com/reference/kotlin/androidx/health/services/client/data/BatchingMode>` | `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/BatchingMode` overrides for exercise updates. Passing an empty set will clear all existing overrides. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if an exercise is not active for this app or Health Service fails to process the call |

### ExerciseClient.pauseExercise

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/ExerciseClientExtension.kt+function:pauseExercise)

```
suspend fun ExerciseClient.pauseExercise(): Void
```

Pauses the current exercise, if it is currently started.

Before transitioning to `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseState#USER_PAUSED()`, Health Services will flush and return the sensor data. While the exercise is paused, active time and cumulative metrics such as distance will not accumulate. Instantaneous measurements such as speed and heart rate will continue to update if requested in the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseConfig`.

Note that GPS and other sensors may be stopped when the exercise is paused in order to conserve battery. This may happen immediately, or after some time. (The exact behavior is hardware dependent.) Should this happen, access will automatically resume when the exercise is resumed.

If the exercise is already paused then this method has no effect. If the exercise has ended then `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` is thrown.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if the exercise has ended or if Health Service fails to process the call |

### ExerciseClient.prepareExercise

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

```
suspend fun ExerciseClient.prepareExercise(configuration: WarmUpConfig): Unit
```

Prepares for a new exercise.

Once called, Health Services will warmup the sensors based on the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseType` and requested `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType`s.

If the calling app already has an active exercise in progress or if it does not have the required permissions, then this call throws `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException`. If another app owns the active exercise then this call will succeed.

Sensors available for warmup are GPS `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType#LOCATION()` and HeartRate `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType#HEART_RATE_BPM()`. Other `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType`s requested for warmup based on exercise capabilities will be a no-op for the prepare stage.

The DataType availability can be obtained through the `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback#onAvailabilityChanged(androidx.health.services.client.data.DataType,androidx.health.services.client.data.Availability)` callback. `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate`s with the supported DataType `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataPoint` will also be returned in the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseState#PREPARING()` state, though no aggregation will occur until the exercise is started.

If an app is actively preparing and another app starts tracking an active exercise then the preparing app should expect to receive an `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate` with `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseState#ENDED()` along with the reason `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseEndReason.Companion#AUTO_END_SUPERSEDED()` to the `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback` indicating that their session has been superseded and ended. At that point no additional updates to availability or data will be sent until the app calls prepareExercise again.

| Parameters |
|---|---|
| `configuration: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/WarmUpConfig` | the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/WarmUpConfig` containing the desired exercise and data types |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if the calling app already has an active exercise in progress or if Health Service fails to process the call |
| `https://developer.android.com/reference/java/lang/SecurityException.html` | if the calling app does not have the required permissions |

### ExerciseClient.removeDebouncedGoalFromActiveExercise

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/ExerciseClientExtension.kt+function:removeDebouncedGoalFromActiveExercise)

```
suspend fun ExerciseClient.removeDebouncedGoalFromActiveExercise(
    debouncedGoal: DebouncedGoal<*>
): Void
```

Removes a debounced goal from an active exercise.

| Parameters |
|---|---|
| `debouncedGoal: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal<*>` | the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DebouncedGoal` to remove from this exercise |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### ExerciseClient.removeGoalFromActiveExercise

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/ExerciseClientExtension.kt+function:removeGoalFromActiveExercise)

```
suspend fun ExerciseClient.removeGoalFromActiveExercise(
    exerciseGoal: ExerciseGoal<*>
): Void
```

Removes an exercise goal for an active exercise.

Takes into account equivalent milestones (i.e. milestones which are not equal but are different representation of a common milestone. e.g. milestone A for every 2kms, currently at threshold of 10kms, and milestone B for every 2kms, currently at threshold of 8kms).

| Parameters |
|---|---|
| `exerciseGoal: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal<*>` | the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseGoal` to remove from this exercise |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### ExerciseClient.resumeExercise

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/ExerciseClientExtension.kt+function:resumeExercise)

```
suspend fun ExerciseClient.resumeExercise(): Void
```

Resumes the current exercise, if it is currently paused.

Once resumed active time and cumulative metrics such as distance will resume accumulating.

If the exercise has been started but is not currently paused this method has no effect. If the exercise has ended then `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` is thrown.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if the exercise has ended or if Health Service fails to process the call |

### PassiveMonitoringClient.setPassiveListenerService

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/PassiveMonitoringClientExtension.kt+function:setPassiveListenerService)

```
suspend fun PassiveMonitoringClient.setPassiveListenerService(
    service: Class<PassiveListenerService>,
    config: PassiveListenerConfig
): Void
```

Subscribes for updates to be periodically delivered to the app.

Data updates will be batched and delivered from the point of initial registration and will continue to be delivered until the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType` is unregistered, either by explicitly calling `https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.PassiveMonitoringClient).clearPassiveListenerService()` or by registering again without that `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType` included in the request. Higher frequency updates are available through `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseClient` or `https://developer.android.com/reference/kotlin/androidx/health/services/client/MeasureClient`. Any requested goal, user activity, or health event updates will not be batched.

Health Services will automatically bind to the provided `https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveListenerService` to send the update. Clients are responsible for defining the service in their app manifest. They should also require the `com.google.android.wearable.healthservices.permission.PASSIVE_DATA_BINDING` permission in their app manifest service definition in order to ensure that Health Services is the source of the binding.

This registration is unique per subscribing app. Subsequent registrations will replace the previous registration, if one had been made. The client is responsible for ensuring that their requested `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/PassiveListenerConfig` is supported on this device by checking the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/PassiveMonitoringCapabilities`. The returned future will fail if the request is not supported on the current device or the client does not have the required permissions for the request.

| Parameters |
|---|---|
| `service: https://developer.android.com/reference/java/lang/Class.html<https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveListenerService>` | the `https://developer.android.com/reference/kotlin/androidx/health/services/client/PassiveListenerService` to bind to |
| `config: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/PassiveListenerConfig` | the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/PassiveListenerConfig` from the client |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |
| `https://developer.android.com/reference/java/lang/SecurityException.html` | if calling app does not have the required permissions |

### ExerciseClient.startExercise

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

```
suspend fun ExerciseClient.startExercise(configuration: ExerciseConfig): Unit
```

Starts a new exercise.

Once started, Health Services will begin collecting data associated with the exercise.

Since Health Services only allows a single active exercise at a time, this will terminate any active exercise currently in progress before starting the new one. If this occurs, clients can expect to receive an `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate` with `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseState#ENDED()`, indicating that their exercise has been superseded and that no additional updates will be sent. Clients can use `https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).getCurrentExerciseInfo()` (described below) to check if they or another app has an active exercise in-progress.

The exercise will be terminated and clients can expect to receive an `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseUpdate` with `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseState#ENDED()` along with the reason `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseEndReason.Companion#AUTO_END_MISSING_LISTENER()` (indicating that their exercise has been automatically ended due to the lack of callback) if there is ever a five minute period where no `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback` is registered. A notable example is if the process with the registered `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback` dies and does not re-register the `https://developer.android.com/reference/kotlin/androidx/health/services/client/ExerciseUpdateCallback` within five minutes.

Clients should only request `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseType`s, `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DataType`s, goals, and auto-pause enabled that matches the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseCapabilities` returned by `https://developer.android.com/reference/kotlin/androidx/health/services/client/package-summary#(androidx.health.services.client.ExerciseClient).getCapabilities()` since Health Services will reject requests asking for unsupported configurations.

| Parameters |
|---|---|
| `configuration: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseConfig` | the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseConfig` describing this exercise |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |
| `https://developer.android.com/reference/java/lang/SecurityException.html` | if the calling app does not have the required permissions |

### MeasureClient.unregisterMeasureCallback

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/MeasureClientExtension.kt+function:unregisterMeasureCallback)

```
suspend fun MeasureClient.unregisterMeasureCallback(
    dataType: DeltaDataType<*, *>,
    callback: MeasureCallback
): Void
```

Unregisters the given `https://developer.android.com/reference/kotlin/androidx/health/services/client/MeasureCallback` for updates of the given `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DeltaDataType`.

| Parameters |
|---|---|
| `dataType: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DeltaDataType<*, *>` | the `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/DeltaDataType` that needs to be unregistered |
| `callback: https://developer.android.com/reference/kotlin/androidx/health/services/client/MeasureCallback` | the `https://developer.android.com/reference/kotlin/androidx/health/services/client/MeasureCallback` which was used in registration |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### ExerciseClient.updateExerciseTypeConfig

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/ExerciseClientExtension.kt+function:updateExerciseTypeConfig)

```
suspend fun ExerciseClient.updateExerciseTypeConfig(
    exerciseTypeConfig: ExerciseTypeConfig
): Void
```

Updates the configurable exercise type attributes for the current exercise.

This can be used to update the configurable attributes for the ongoing exercise, as defined in `https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseTypeConfig`.

| Parameters |
|---|---|
| `exerciseTypeConfig: https://developer.android.com/reference/kotlin/androidx/health/services/client/data/ExerciseTypeConfig` | configuration containing the new values for the configurable attributes |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |