# PassiveMonitoringClient

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

*** ** * ** ***

<br />

```
public interface PassiveMonitoringClient
```

<br />

*** ** * ** ***

Client which provides a means to passively monitor data without requiring an ongoing workout.

The lifetimes of registrations made through this client are independent of the lifetime of the subscribing app. These registrations are therefore suitable for notifying of ongoing measurements or triggered passive goals, regardless of whether or not the subscribing app is currently running, in the foreground or engaged in a workout.

## Summary

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html>` | `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#clearPassiveListenerCallbackAsync()()` Unregisters the subscription made by `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerCallback(androidx.health.services.client.data.PassiveListenerConfig,androidx.health.services.client.PassiveListenerCallback)`. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html>` | `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#clearPassiveListenerServiceAsync()()` Unregisters the subscription made by `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerServiceAsync(java.lang.Class,androidx.health.services.client.data.PassiveListenerConfig)`. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html>` | `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#flushAsync()()` Flushes the sensors for the registered `https://developer.android.com/reference/androidx/health/services/client/data/DataType`s. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveMonitoringCapabilities>` | `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#getCapabilitiesAsync()()` Returns the `https://developer.android.com/reference/androidx/health/services/client/data/PassiveMonitoringCapabilities` of this client for this device. |
| `abstract void` | `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerCallback(androidx.health.services.client.data.PassiveListenerConfig,androidx.health.services.client.PassiveListenerCallback)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveListenerConfig config, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback callback )` Subscribes for updates to be periodically delivered to the app via bound callback. |
| `abstract void` | `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerCallback(androidx.health.services.client.data.PassiveListenerConfig,java.util.concurrent.Executor,androidx.health.services.client.PassiveListenerCallback)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveListenerConfig config, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback callback )` Subscribes for updates to be periodically delivered to the app via bound callback. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html>` | `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerServiceAsync(java.lang.Class,androidx.health.services.client.data.PassiveListenerConfig)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveListenerService> service, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveListenerConfig config )` Subscribes for updates to be periodically delivered to the app. |

| ### Extension functions |
|---|---|
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClientExtensionKt.https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#(androidx.health.services.client.PassiveMonitoringClient).clearPassiveListenerCallback()( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient receiver )` Unregisters the subscription made by `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerCallback(androidx.health.services.client.data.PassiveListenerConfig,androidx.health.services.client.PassiveListenerCallback)`. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClientExtensionKt.https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#(androidx.health.services.client.PassiveMonitoringClient).clearPassiveListenerService()( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient receiver )` Unregisters the subscription made by `https://developer.android.com/reference/androidx/health/services/client/package-summary#(androidx.health.services.client.PassiveMonitoringClient).setPassiveListenerService(java.lang.Class,androidx.health.services.client.data.PassiveListenerConfig)`. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClientExtensionKt.https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#(androidx.health.services.client.PassiveMonitoringClient).flush()( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient receiver )` Flushes the sensors for the registered `https://developer.android.com/reference/androidx/health/services/client/data/DataType`s. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveMonitoringCapabilities` | `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClientExtensionKt.https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#(androidx.health.services.client.PassiveMonitoringClient).getCapabilities()( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient receiver )` Returns the `https://developer.android.com/reference/androidx/health/services/client/data/PassiveMonitoringCapabilities` of this client for this device. |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html` | `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClientExtensionKt.https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#(androidx.health.services.client.PassiveMonitoringClient).setPassiveListenerService(java.lang.Class,androidx.health.services.client.data.PassiveListenerConfig)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveListenerService> service, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveListenerConfig config )` Subscribes for updates to be periodically delivered to the app. |

## Public methods

### clearPassiveListenerCallbackAsync

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

```
abstract @NonNull ListenableFuture<@NonNull Void> clearPassiveListenerCallbackAsync()
```

Unregisters the subscription made by `https://developer.android.com/reference/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.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html>` | a `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` that completes when the un-registration succeeds in Health Services. This is a no-op if the callback has already been unregistered |

### clearPassiveListenerServiceAsync

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

```
abstract @NonNull ListenableFuture<@NonNull Void> clearPassiveListenerServiceAsync()
```

Unregisters the subscription made by `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerServiceAsync(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.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html>` | a `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` that completes when the un-registration succeeds in Health Services. This is a no-op if the callback has already been unregistered |

### flushAsync

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

```
abstract @NonNull ListenableFuture<@NonNull Void> flushAsync()
```

Flushes the sensors for the registered `https://developer.android.com/reference/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.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html>` | a `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` that will complete when the flush is finished |

### getCapabilitiesAsync

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

```
abstract @NonNull ListenableFuture<@NonNull PassiveMonitoringCapabilities> getCapabilitiesAsync()
```

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

This can be used to determine what `https://developer.android.com/reference/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/androidx/health/services/client/data/DataType`s which are not supported.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveMonitoringCapabilities>` | a `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` containing the `https://developer.android.com/reference/androidx/health/services/client/data/PassiveMonitoringCapabilities` for this device |

### setPassiveListenerCallback

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

```
abstract void setPassiveListenerCallback(
    @NonNull PassiveListenerConfig config,
    @NonNull PassiveListenerCallback callback
)
```

Subscribes for updates to be periodically delivered to the app via bound callback.

Data updates are sent on generation (they will not be batched) and will be delivered until the `https://developer.android.com/reference/androidx/health/services/client/data/DataType` is unregistered, either by explicitly calling `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#clearPassiveListenerCallbackAsync()` or by registering again without that `https://developer.android.com/reference/androidx/health/services/client/data/DataType` included in the request. Higher frequency updates are available through `https://developer.android.com/reference/androidx/health/services/client/ExerciseClient` or `https://developer.android.com/reference/androidx/health/services/client/MeasureClient`.

The provided `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerCallback(androidx.health.services.client.data.PassiveListenerConfig,androidx.health.services.client.PassiveListenerCallback)` will take priority in receiving updates as long the app is alive and the callback can be successfully notified. Otherwise, the request will automatically be unregistered.

This registration is unique per subscribing app and operates independently from `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerServiceAsync(java.lang.Class,androidx.health.services.client.data.PassiveListenerConfig)` (each channel will receive its own stream of data). 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/androidx/health/services/client/data/PassiveListenerConfig` is supported on this device by checking the `https://developer.android.com/reference/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.

This call completes when the registration succeeds in Health Services. If the request is not supported on this device or the calling app lacks permissions, then `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback#onRegistrationFailed(kotlin.Throwable)` will be invoked on the provided `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerCallback(androidx.health.services.client.data.PassiveListenerConfig,androidx.health.services.client.PassiveListenerCallback)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveListenerConfig config` | the requested `https://developer.android.com/reference/androidx/health/services/client/data/PassiveListenerConfig` from the client |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback callback` | the `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback` that will receive updates on the main thread |

### setPassiveListenerCallback

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

```
abstract void setPassiveListenerCallback(
    @NonNull PassiveListenerConfig config,
    @NonNull Executor executor,
    @NonNull PassiveListenerCallback callback
)
```

Subscribes for updates to be periodically delivered to the app via bound callback.

Data updates are sent on generation (they will not be batched) and will be delivered until the `https://developer.android.com/reference/androidx/health/services/client/data/DataType` is unregistered, either by explicitly calling `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#clearPassiveListenerCallbackAsync()` or by registering again without that `https://developer.android.com/reference/androidx/health/services/client/data/DataType` included in the request. Higher frequency updates are available through `https://developer.android.com/reference/androidx/health/services/client/ExerciseClient` or `https://developer.android.com/reference/androidx/health/services/client/MeasureClient`.

The provided `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerCallback(androidx.health.services.client.data.PassiveListenerConfig,java.util.concurrent.Executor,androidx.health.services.client.PassiveListenerCallback)` will take priority in receiving updates as long the app is alive and the callback can be successfully notified. Otherwise, the request will automatically be unregistered.

This registration is unique per subscribing app and operates independently from `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerServiceAsync(java.lang.Class,androidx.health.services.client.data.PassiveListenerConfig)` (each channel will receive its own stream of data). 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/androidx/health/services/client/data/PassiveListenerConfig` is supported on this device by checking the `https://developer.android.com/reference/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.

This call completes when the registration succeeds in Health Services. If the request is not supported on this device or the calling app lacks permissions, then `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback#onRegistrationFailed(kotlin.Throwable)` will be invoked on the provided `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerCallback(androidx.health.services.client.data.PassiveListenerConfig,java.util.concurrent.Executor,androidx.health.services.client.PassiveListenerCallback)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveListenerConfig config` | the requested `https://developer.android.com/reference/androidx/health/services/client/data/PassiveListenerConfig` from the client |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor` | the `https://developer.android.com/reference/java/util/concurrent/Executor.html` on which the `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#setPassiveListenerCallback(androidx.health.services.client.data.PassiveListenerConfig,java.util.concurrent.Executor,androidx.health.services.client.PassiveListenerCallback)` will be invoked |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback callback` | the `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback` that will receive updates |

### setPassiveListenerServiceAsync

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

```
abstract @NonNull ListenableFuture<@NonNull Void> setPassiveListenerServiceAsync(
    @NonNull Class<@NonNull PassiveListenerService> service,
    @NonNull PassiveListenerConfig config
)
```

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/androidx/health/services/client/data/DataType` is unregistered, either by explicitly calling `https://developer.android.com/reference/androidx/health/services/client/PassiveMonitoringClient#clearPassiveListenerServiceAsync()` or by registering again without that `https://developer.android.com/reference/androidx/health/services/client/data/DataType` included in the request. Higher frequency updates are available through `https://developer.android.com/reference/androidx/health/services/client/ExerciseClient` or `https://developer.android.com/reference/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/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/androidx/health/services/client/data/PassiveListenerConfig` is supported on this device by checking the `https://developer.android.com/reference/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveListenerService> service` | the `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerService` to bind to |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveListenerConfig config` | the `https://developer.android.com/reference/androidx/health/services/client/data/PassiveListenerConfig` from the client |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Void.html>` | a `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` that completes when the registration succeeds in Health Services or fails when the request is not supported on the current device or the client does not have the required permissions for the request |

## Extension functions

### PassiveMonitoringClientExtensionKt.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)

```
default final @NonNull Void PassiveMonitoringClientExtensionKt.clearPassiveListenerCallback(
    @NonNull PassiveMonitoringClient receiver
)
```

Unregisters the subscription made by `https://developer.android.com/reference/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/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### PassiveMonitoringClientExtensionKt.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)

```
default final @NonNull Void PassiveMonitoringClientExtensionKt.clearPassiveListenerService(
    @NonNull PassiveMonitoringClient receiver
)
```

Unregisters the subscription made by `https://developer.android.com/reference/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/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### PassiveMonitoringClientExtensionKt.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)

```
default final @NonNull Void PassiveMonitoringClientExtensionKt.flush(
    @NonNull PassiveMonitoringClient receiver
)
```

Flushes the sensors for the registered `https://developer.android.com/reference/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/androidx/health/services/client/HealthServicesException` | if Health Service fails to process the call |

### PassiveMonitoringClientExtensionKt.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)

```
default final @NonNull PassiveMonitoringCapabilities PassiveMonitoringClientExtensionKt.getCapabilities(
    @NonNull PassiveMonitoringClient receiver
)
```

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

This can be used to determine what `https://developer.android.com/reference/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/androidx/health/services/client/data/DataType`s which are not supported.

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

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

### PassiveMonitoringClientExtensionKt.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)

```
default final @NonNull Void PassiveMonitoringClientExtensionKt.setPassiveListenerService(
    @NonNull PassiveMonitoringClient receiver,
    @NonNull Class<@NonNull PassiveListenerService> service,
    @NonNull PassiveListenerConfig config
)
```

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/androidx/health/services/client/data/DataType` is unregistered, either by explicitly calling `https://developer.android.com/reference/androidx/health/services/client/package-summary#(androidx.health.services.client.PassiveMonitoringClient).clearPassiveListenerService()` or by registering again without that `https://developer.android.com/reference/androidx/health/services/client/data/DataType` included in the request. Higher frequency updates are available through `https://developer.android.com/reference/androidx/health/services/client/ExerciseClient` or `https://developer.android.com/reference/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/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/androidx/health/services/client/data/PassiveListenerConfig` is supported on this device by checking the `https://developer.android.com/reference/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Class.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/PassiveListenerService> service` | the `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerService` to bind to |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveListenerConfig config` | the `https://developer.android.com/reference/androidx/health/services/client/data/PassiveListenerConfig` from the client |

| Throws |
|---|---|
| `https://developer.android.com/reference/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 |