ExerciseConfig.Builder


class ExerciseConfig.Builder


Builder for ExerciseConfig instances.

Summary

Public constructors

Builder(exerciseType: ExerciseType)

Public functions

ExerciseConfig

Returns the built ExerciseConfig.

ExerciseConfig.Builder
setBatchingModeOverrides(batchingModeOverrides: Set<BatchingMode>)

Sets the BatchingMode overrides for the ongoing exercise.

ExerciseConfig.Builder
setDataTypes(dataTypes: Set<DataType<*, *>>)

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

ExerciseConfig.Builder
setDebouncedGoals(debouncedGoals: List<DebouncedGoal<*>>)

Sets DebouncedGoals specified for this exercise.

ExerciseConfig.Builder
setExerciseEventTypes(exerciseEventTypes: Set<ExerciseEventType<*>>)

Sets the ExerciseEventTypes that should be tracked for this exercise.

ExerciseConfig.Builder
setExerciseGoals(exerciseGoals: List<ExerciseGoal<*>>)

Sets ExerciseGoals specified for this exercise.

ExerciseConfig.Builder
setExerciseParams(exerciseParams: Bundle)

Sets additional OEM specific parameters for the current exercise.

ExerciseConfig.Builder

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

ExerciseConfig.Builder
setIsAutoPauseAndResumeEnabled(isAutoPauseAndResumeEnabled: Boolean)

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

ExerciseConfig.Builder
setIsGpsEnabled(isGpsEnabled: Boolean)

Sets whether GPS will be used for this exercise.

ExerciseConfig.Builder
setSwimmingPoolLengthMeters(swimmingPoolLength: Float)

Sets the swimming pool length (in m).

Public constructors

Builder

Added in 1.0.0
Builder(exerciseType: ExerciseType)

Public functions

build

Added in 1.0.0
fun build(): ExerciseConfig

Returns the built ExerciseConfig.

setBatchingModeOverrides

Added in 1.0.0
fun setBatchingModeOverrides(batchingModeOverrides: Set<BatchingMode>): ExerciseConfig.Builder

Sets the BatchingMode overrides for the ongoing exercise.

Parameters
batchingModeOverrides: Set<BatchingMode>

BatchingMode overrides

setDataTypes

fun setDataTypes(dataTypes: Set<DataType<*, *>>): ExerciseConfig.Builder

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
dataTypes: Set<DataType<*, *>>

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

setDebouncedGoals

fun setDebouncedGoals(debouncedGoals: List<DebouncedGoal<*>>): ExerciseConfig.Builder

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
debouncedGoals: List<DebouncedGoal<*>>

the list of DeoubcendGoals to begin the exercise with

setExerciseEventTypes

fun setExerciseEventTypes(exerciseEventTypes: Set<ExerciseEventType<*>>): ExerciseConfig.Builder

Sets the ExerciseEventTypes that should be tracked for this exercise.

Parameters
exerciseEventTypes: Set<ExerciseEventType<*>>

the set of ExerciseEventTypes to begin the exercise with

setExerciseGoals

fun setExerciseGoals(exerciseGoals: List<ExerciseGoal<*>>): ExerciseConfig.Builder

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
exerciseGoals: List<ExerciseGoal<*>>

the list of ExerciseGoals to begin the exercise with

setExerciseParams

Added in 1.0.0
fun setExerciseParams(exerciseParams: Bundle): ExerciseConfig.Builder

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

Parameters
exerciseParams: Bundle

Bundle containing OEM specific parameters

setExerciseTypeConfig

Added in 1.0.0
fun setExerciseTypeConfig(exerciseTypeConfig: ExerciseTypeConfig?): ExerciseConfig.Builder

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
fun setIsAutoPauseAndResumeEnabled(isAutoPauseAndResumeEnabled: Boolean): ExerciseConfig.Builder

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

Parameters
isAutoPauseAndResumeEnabled: Boolean

if true, exercise will automatically pause and resume

setIsGpsEnabled

Added in 1.0.0
fun setIsGpsEnabled(isGpsEnabled: Boolean): ExerciseConfig.Builder

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
isGpsEnabled: Boolean

if true, GPS will be enabled for this exercise

setSwimmingPoolLengthMeters

Added in 1.0.0
fun setSwimmingPoolLengthMeters(swimmingPoolLength: Float): ExerciseConfig.Builder

Sets the swimming pool length (in m).