ExerciseConfig.Builder


public final class ExerciseConfig.Builder


Builder for ExerciseConfig instances.

Summary

Public constructors

Builder(@NonNull ExerciseType exerciseType)

Public methods

final @NonNull ExerciseConfig

Returns the built ExerciseConfig.

final @NonNull ExerciseConfig.Builder
setBatchingModeOverrides(
    @NonNull Set<@NonNull BatchingMode> batchingModeOverrides
)

Sets the BatchingMode overrides for the ongoing exercise.

final @NonNull ExerciseConfig.Builder
setDataTypes(
    @NonNull Set<@NonNull DataType<@NonNull ?, @NonNull ?>> dataTypes
)

Sets the requested DataTypes that should be tracked during this exercise.

final @NonNull ExerciseConfig.Builder
setDebouncedGoals(
    @NonNull List<@NonNull DebouncedGoal<@NonNull ?>> debouncedGoals
)

Sets DebouncedGoals specified for this exercise.

final @NonNull ExerciseConfig.Builder

Sets the ExerciseEventTypes that should be tracked for this exercise.

final @NonNull ExerciseConfig.Builder
setExerciseGoals(
    @NonNull List<@NonNull ExerciseGoal<@NonNull ?>> exerciseGoals
)

Sets ExerciseGoals specified for this exercise.

final @NonNull ExerciseConfig.Builder
setExerciseParams(@NonNull Bundle exerciseParams)

Sets additional OEM specific parameters for the current exercise.

final @NonNull ExerciseConfig.Builder

Sets the ExerciseTypeConfig which are configurable attributes for the ongoing exercise.

final @NonNull ExerciseConfig.Builder
setIsAutoPauseAndResumeEnabled(boolean isAutoPauseAndResumeEnabled)

Sets whether auto pause and auto resume should be enabled for this exercise.

final @NonNull ExerciseConfig.Builder
setIsGpsEnabled(boolean isGpsEnabled)

Sets whether GPS will be used for this exercise.

final @NonNull ExerciseConfig.Builder
setSwimmingPoolLengthMeters(float swimmingPoolLength)

Sets the swimming pool length (in m).

Public constructors

Builder

Added in 1.0.0
public Builder(@NonNull ExerciseType exerciseType)

Public methods

build

Added in 1.0.0
public final @NonNull ExerciseConfig build()

Returns the built ExerciseConfig.

setBatchingModeOverrides

Added in 1.0.0
public final @NonNull ExerciseConfig.Builder setBatchingModeOverrides(
    @NonNull Set<@NonNull BatchingMode> batchingModeOverrides
)

Sets the BatchingMode overrides for the ongoing exercise.

Parameters
@NonNull Set<@NonNull BatchingMode> batchingModeOverrides

BatchingMode overrides

setDataTypes

public final @NonNull ExerciseConfig.Builder setDataTypes(
    @NonNull Set<@NonNull DataType<@NonNull ?, @NonNull ?>> dataTypes
)

Sets the requested DataTypes that should be tracked during this exercise. If not explicitly called, a default set of DataTypes will be chosen based on the ExerciseType.

Parameters
@NonNull Set<@NonNull DataType<@NonNull ?, @NonNull ?>> dataTypes

set of DataTypes (AggregateDataType or DeltaDataType) to track during this exercise

setDebouncedGoals

public final @NonNull ExerciseConfig.Builder setDebouncedGoals(
    @NonNull List<@NonNull DebouncedGoal<@NonNull ?>> debouncedGoals
)

Sets DebouncedGoals specified for this exercise.

DataTypes in DebouncedGoals must also be tracked. Only one debounced goal per data type can be tracked in an exercise. If multiple debuonced goals of the same data type, only the last one will be applied.

Parameters
@NonNull List<@NonNull DebouncedGoal<@NonNull ?>> debouncedGoals

the list of DeoubcendGoals to begin the exercise with

setExerciseEventTypes

public final @NonNull ExerciseConfig.Builder setExerciseEventTypes(
    @NonNull Set<@NonNull ExerciseEventType<@NonNull ?>> exerciseEventTypes
)

Sets the ExerciseEventTypes that should be tracked for this exercise.

Parameters
@NonNull Set<@NonNull ExerciseEventType<@NonNull ?>> exerciseEventTypes

the set of ExerciseEventTypes to begin the exercise with

setExerciseGoals

public final @NonNull ExerciseConfig.Builder setExerciseGoals(
    @NonNull List<@NonNull ExerciseGoal<@NonNull ?>> exerciseGoals
)

Sets ExerciseGoals specified for this exercise.

DataTypes in ExerciseGoals must also be tracked (i.e. provided to setDataTypes) in some form. For example, an ExerciseGoal for DataType.STEPS_TOTAL requires that either or both of DataType.STEPS_TOTAL / DataType.STEPS be passed into setDataTypes.

Parameters
@NonNull List<@NonNull ExerciseGoal<@NonNull ?>> exerciseGoals

the list of ExerciseGoals to begin the exercise with

setExerciseParams

Added in 1.0.0
public final @NonNull ExerciseConfig.Builder setExerciseParams(@NonNull Bundle exerciseParams)

Sets additional OEM specific parameters for the current exercise. Intended to be used by OEMs or apps working closely with them.

Parameters
@NonNull Bundle exerciseParams

Bundle containing OEM specific parameters

setExerciseTypeConfig

Added in 1.0.0
public final @NonNull ExerciseConfig.Builder setExerciseTypeConfig(ExerciseTypeConfig exerciseTypeConfig)

Sets the ExerciseTypeConfig which are configurable attributes for the ongoing exercise.

Parameters
ExerciseTypeConfig exerciseTypeConfig

ExerciseTypeConfig specifying active exercise type configurations

setIsAutoPauseAndResumeEnabled

Added in 1.0.0
public final @NonNull ExerciseConfig.Builder setIsAutoPauseAndResumeEnabled(boolean isAutoPauseAndResumeEnabled)

Sets whether auto pause and auto resume should be enabled for this exercise. If not set, auto-pause is disabled by default.

Parameters
boolean isAutoPauseAndResumeEnabled

if true, exercise will automatically pause and resume

setIsGpsEnabled

Added in 1.0.0
public final @NonNull ExerciseConfig.Builder setIsGpsEnabled(boolean isGpsEnabled)

Sets whether GPS will be used for this exercise. If not set, it's disabled by default.

If DataType.LOCATION is among the data types requested for the exercise, GPS usage MUST be enabled. Enabling GPS will improve data generation for types like distance and speed.

If no data type is specified in the configuration, WHS provides all data types supported for the exercise. In this case, if DataType.LOCATION is among the supported data types for the exercise but GPS usage is disabled (i.e. isGpsEnabled is false, then ExerciseClient.startExerciseAsync will fail.

Parameters
boolean isGpsEnabled

if true, GPS will be enabled for this exercise

setSwimmingPoolLengthMeters

Added in 1.0.0
public final @NonNull ExerciseConfig.Builder setSwimmingPoolLengthMeters(float swimmingPoolLength)

Sets the swimming pool length (in m).