# PassiveListenerCallback

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

*** ** * ** ***


```
public interface PassiveListenerCallback
```

<br />

*** ** * ** ***

A callback for receiving passive monitoring updates.

## Summary

| ### Public methods |
|---|---|
| `default void` | `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback#onGoalCompleted(androidx.health.services.client.data.PassiveGoal)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveGoal goal)` Called when a `https://developer.android.com/reference/androidx/health/services/client/data/PassiveGoal` has been completed. |
| `default void` | `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback#onHealthEventReceived(androidx.health.services.client.data.HealthEvent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/HealthEvent event)` Called when a `https://developer.android.com/reference/androidx/health/services/client/data/HealthEvent` has been detected. |
| `default void` | `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback#onNewDataPointsReceived(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 dataPoints)` Called when new `https://developer.android.com/reference/androidx/health/services/client/data/DataPoint`s are generated. |
| `default void` | `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback#onPermissionLost()()` Called when the client has lost permission for the passive listener request. |
| `default void` | `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback#onRegistered()()` Called when this callback has been successfully registered with Health Services. |
| `default void` | `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback#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. |
| `default void` | `https://developer.android.com/reference/androidx/health/services/client/PassiveListenerCallback#onUserActivityInfoReceived(androidx.health.services.client.data.UserActivityInfo)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo info)` Called when new `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` is generated. |

## Public methods

### onGoalCompleted

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

```
default void onGoalCompleted(@NonNull PassiveGoal goal)
```

Called when a `https://developer.android.com/reference/androidx/health/services/client/data/PassiveGoal` has been completed.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/PassiveGoal goal` | the `https://developer.android.com/reference/androidx/health/services/client/data/PassiveGoal` that has been completed |

### onHealthEventReceived

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

```
default void onHealthEventReceived(@NonNull HealthEvent event)
```

Called when a `https://developer.android.com/reference/androidx/health/services/client/data/HealthEvent` has been detected.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/HealthEvent event` | the `https://developer.android.com/reference/androidx/health/services/client/data/HealthEvent` that has been detected |

### onNewDataPointsReceived

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

```
default void onNewDataPointsReceived(@NonNull DataPointContainer dataPoints)
```

Called when new `https://developer.android.com/reference/androidx/health/services/client/data/DataPoint`s are generated.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/DataPointContainer dataPoints` | a list of new `https://developer.android.com/reference/androidx/health/services/client/data/DataPoint`s generated |

### onPermissionLost

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

```
default void onPermissionLost()
```

Called when the client has lost permission for the passive listener request. If this happens, WHS will automatically unregister the client request and stop the relevant sensors. The client can use this callback to detect the problem and either prompt the user to re-grant the permissions or re-register while requesting only that which the app does have permission for.

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

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

### onUserActivityInfoReceived

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

```
default void onUserActivityInfoReceived(@NonNull UserActivityInfo info)
```

Called when new `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` is generated.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo info` | a new `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` representing the current state |