PassiveListenerConfig

public final class PassiveListenerConfig


Defines configuration for a passive monitoring listener request using Health Services.

Summary

Nested types

Builder for PassiveListenerConfig instances.

Public constructors

PassiveListenerConfig(
    @NonNull Set<@NonNull DataType<@NonNull Object, @NonNull DataPoint<@NonNull Object>>> dataTypes,
    boolean shouldUserActivityInfoBeRequested,
    @NonNull Set<@NonNull PassiveGoal> dailyGoals,
    @NonNull Set<@NonNull HealthEvent.Type> healthEventTypes
)

Creates a new PassiveListenerConfig which defines a request for passive monitoring using Health Services

Public methods

static final @NonNull PassiveListenerConfig.Builder
final @NonNull Set<@NonNull PassiveGoal>

set of daily PassiveGoals which should be tracked.

final @NonNull Set<@NonNull DataType<@NonNull Object, @NonNull DataPoint<@NonNull Object>>>

set of DataTypes which should be tracked.

final @NonNull Set<@NonNull HealthEvent.Type>

set of HealthEvent.Type which should be tracked.

final boolean

whether to request UserActivityInfo updates.

Public constructors

PassiveListenerConfig

public PassiveListenerConfig(
    @NonNull Set<@NonNull DataType<@NonNull Object, @NonNull DataPoint<@NonNull Object>>> dataTypes,
    boolean shouldUserActivityInfoBeRequested,
    @NonNull Set<@NonNull PassiveGoal> dailyGoals,
    @NonNull Set<@NonNull HealthEvent.Type> healthEventTypes
)

Creates a new PassiveListenerConfig which defines a request for passive monitoring using Health Services

Public methods

builder

Added in 1.0.0
public static final @NonNull PassiveListenerConfig.Builder builder()

getDailyGoals

Added in 1.0.0
public final @NonNull Set<@NonNull PassiveGoalgetDailyGoals()

set of daily PassiveGoals which should be tracked. Achieved goals will be returned by PassiveListenerCallback.onGoalCompleted.

getDataTypes

Added in 1.0.0
public final @NonNull Set<@NonNull DataType<@NonNull Object, @NonNull DataPoint<@NonNull Object>>> getDataTypes()

set of DataTypes which should be tracked. Requested data will be returned by PassiveListenerCallback.onNewDataPointsReceived.

getHealthEventTypes

Added in 1.0.0
public final @NonNull Set<@NonNull HealthEvent.TypegetHealthEventTypes()

set of HealthEvent.Type which should be tracked. Detected health events will be returned by PassiveListenerCallback.onHealthEventReceived.

shouldUserActivityInfoBeRequested

public final boolean shouldUserActivityInfoBeRequested()

whether to request UserActivityInfo updates. Data will be returned by PassiveListenerCallback.onUserActivityInfoReceived. If set to true, calling app must have android.Manifest.permission.ACTIVITY_RECOGNITION.