# UserActivityInfo

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

*** ** * ** ***


```
public final class UserActivityInfo
```

<br />

*** ** * ** ***

Represents an update from Passive tracking.

Provides `https://developer.android.com/reference/androidx/health/services/client/data/DataPoint`s associated with the Passive tracking, in addition to data related to the user's `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo#UserActivityInfo(androidx.health.services.client.data.UserActivityState,androidx.health.services.client.data.ExerciseInfo,java.time.Instant)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState userActivityState, https://developer.android.com/reference/androidx/health/services/client/data/ExerciseInfo exerciseInfo, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html stateChangeTime )` |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` | `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo#createActiveExerciseState(androidx.health.services.client.data.ExerciseInfo,java.time.Instant)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseInfo exerciseInfo, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html stateChangeTime )` Creates a `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` for `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState#USER_ACTIVITY_EXERCISE()`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` | `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo#createAsleepState(java.time.Instant)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html stateChangeTime)` Creates a `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` for `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState#USER_ACTIVITY_ASLEEP()`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` | `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo#createPassiveActivityState(java.time.Instant)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html stateChangeTime)` Creates a `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` for `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState#USER_ACTIVITY_PASSIVE()`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` | `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo#createUnknownTypeState(java.time.Instant)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html stateChangeTime)` Creates a `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` for `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState#USER_ACTIVITY_UNKNOWN()`. |
| `final https://developer.android.com/reference/androidx/health/services/client/data/ExerciseInfo` | `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo#getExerciseInfo()()` The `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseInfo` of the user for a `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState#USER_ACTIVITY_EXERCISE()` state, and `null` for other `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState`s. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo#getStateChangeTime()()` The time at which the current state took effect. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState` | `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo#getUserActivityState()()` The `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState` of the user from Passive tracking. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo#toString()()` |

## Public constructors

### UserActivityInfo

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

```
public UserActivityInfo(
    @NonNull UserActivityState userActivityState,
    ExerciseInfo exerciseInfo,
    @NonNull Instant stateChangeTime
)
```

## Public methods

### createActiveExerciseState

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

```
public static final @NonNull UserActivityInfo createActiveExerciseState(
    @NonNull ExerciseInfo exerciseInfo,
    @NonNull Instant stateChangeTime
)
```

Creates a `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` for `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState#USER_ACTIVITY_EXERCISE()`.

### createAsleepState

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

```
public static final @NonNull UserActivityInfo createAsleepState(@NonNull Instant stateChangeTime)
```

Creates a `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` for `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState#USER_ACTIVITY_ASLEEP()`.

### createPassiveActivityState

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

```
public static final @NonNull UserActivityInfo createPassiveActivityState(@NonNull Instant stateChangeTime)
```

Creates a `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` for `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState#USER_ACTIVITY_PASSIVE()`.

### createUnknownTypeState

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

```
public static final @NonNull UserActivityInfo createUnknownTypeState(@NonNull Instant stateChangeTime)
```

Creates a `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityInfo` for `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState#USER_ACTIVITY_UNKNOWN()`.

### getExerciseInfo

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

```
public final ExerciseInfo getExerciseInfo()
```

The `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseInfo` of the user for a `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState#USER_ACTIVITY_EXERCISE()` state, and `null` for other `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState`s.

### getStateChangeTime

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

```
public final @NonNull Instant getStateChangeTime()
```

The time at which the current state took effect.

### getUserActivityState

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

```
public final @NonNull UserActivityState getUserActivityState()
```

The `https://developer.android.com/reference/androidx/health/services/client/data/UserActivityState` of the user from Passive tracking.

### toString

```
public @NonNull String toString()
```