UserActivityInfo


public final class UserActivityInfo


Represents an update from Passive tracking.

Provides DataPoints associated with the Passive tracking, in addition to data related to the user's UserActivityState.

Summary

Public constructors

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

Public methods

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

Creates a UserActivityInfo for USER_ACTIVITY_EXERCISE.

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

Creates a UserActivityInfo for USER_ACTIVITY_ASLEEP.

static final @NonNull UserActivityInfo

Creates a UserActivityInfo for USER_ACTIVITY_PASSIVE.

static final @NonNull UserActivityInfo

Creates a UserActivityInfo for USER_ACTIVITY_UNKNOWN.

final ExerciseInfo

The ExerciseInfo of the user for a UserActivityState.USER_ACTIVITY_EXERCISE state, and null for other UserActivityStates.

final @NonNull Instant

The time at which the current state took effect.

final @NonNull UserActivityState

The UserActivityState of the user from Passive tracking.

@NonNull String

Public constructors

UserActivityInfo

Added in 1.0.0
public UserActivityInfo(
    @NonNull UserActivityState userActivityState,
    ExerciseInfo exerciseInfo,
    @NonNull Instant stateChangeTime
)

Public methods

createActiveExerciseState

Added in 1.0.0
public static final @NonNull UserActivityInfo createActiveExerciseState(
    @NonNull ExerciseInfo exerciseInfo,
    @NonNull Instant stateChangeTime
)

Creates a UserActivityInfo for USER_ACTIVITY_EXERCISE.

createAsleepState

Added in 1.0.0
public static final @NonNull UserActivityInfo createAsleepState(@NonNull Instant stateChangeTime)

Creates a UserActivityInfo for USER_ACTIVITY_ASLEEP.

createPassiveActivityState

Added in 1.0.0
public static final @NonNull UserActivityInfo createPassiveActivityState(@NonNull Instant stateChangeTime)

Creates a UserActivityInfo for USER_ACTIVITY_PASSIVE.

createUnknownTypeState

Added in 1.0.0
public static final @NonNull UserActivityInfo createUnknownTypeState(@NonNull Instant stateChangeTime)

Creates a UserActivityInfo for USER_ACTIVITY_UNKNOWN.

getExerciseInfo

Added in 1.0.0
public final ExerciseInfo getExerciseInfo()

The ExerciseInfo of the user for a UserActivityState.USER_ACTIVITY_EXERCISE state, and null for other UserActivityStates.

getStateChangeTime

Added in 1.0.0
public final @NonNull Instant getStateChangeTime()

The time at which the current state took effect.

getUserActivityState

Added in 1.0.0
public final @NonNull UserActivityState getUserActivityState()

The UserActivityState of the user from Passive tracking.

toString

public @NonNull String toString()