ExerciseConfig


public final class ExerciseConfig


Defines configuration for an exercise tracked using Health Services.

Summary

Nested types

public final class ExerciseConfig.Builder

Builder for ExerciseConfig instances.

Constants

static final float

Public constructors

ExerciseConfig(
    @NonNull ExerciseType exerciseType,
    @NonNull Set<@NonNull DataType<@NonNull ?, @NonNull ?>> dataTypes,
    boolean isAutoPauseAndResumeEnabled,
    boolean isGpsEnabled,
    @NonNull List<@NonNull ExerciseGoal<@NonNull ?>> exerciseGoals,
    @NonNull Bundle exerciseParams,
    @FloatRange(from = 0.0) float swimmingPoolLengthMeters,
    ExerciseTypeConfig exerciseTypeConfig,
    @NonNull Set<@NonNull BatchingMode> batchingModeOverrides,
    @NonNull Set<@NonNull ExerciseEventType<@NonNull ?>> exerciseEventTypes,
    @NonNull List<@NonNull DebouncedGoal<@NonNull ?>> debouncedGoals
)

Creates a new ExerciseConfig for an exercise tracked using Health Services

Public methods

static final @NonNull ExerciseConfig.Builder
builder(@NonNull ExerciseType exerciseType)

Returns a fresh new Builder.

final @NonNull Set<@NonNull BatchingMode>

BatchingMode overrides for this exercise

final @NonNull Set<@NonNull DataType<@NonNull ?, @NonNull ?>>

DataType which will be tracked for this exercise

final @NonNull List<@NonNull DebouncedGoal<@NonNull ?>>

DebouncedGoals for this exercise.

final @NonNull Set<@NonNull ExerciseEventType<@NonNull ?>>

ExerciseEventTypes which should be tracked for this exercise

final @NonNull List<@NonNull ExerciseGoal<@NonNull ?>>

ExerciseGoals for this exercise.

final @NonNull Bundle

Bundle bundle for specifying exercise presets, the values of an on-going exercise which can be used to pre-populate a new exercise.

final @NonNull ExerciseType

ExerciseType user is performing for this exercise

final ExerciseTypeConfig

ExerciseTypeConfig containing attributes which may be modified after the exercise has started

final float

length (in meters) of the swimming pool, or 0 if not relevant to this exercise

final boolean

whether auto-pause/resume is enabled for this exercise

final boolean

whether GPS is enabled for this exercise.

@NonNull String

Constants

SWIMMING_POOL_LENGTH_UNSPECIFIED

public static final float SWIMMING_POOL_LENGTH_UNSPECIFIED = 0.0f

Public constructors

ExerciseConfig

public ExerciseConfig(
    @NonNull ExerciseType exerciseType,
    @NonNull Set<@NonNull DataType<@NonNull ?, @NonNull ?>> dataTypes,
    boolean isAutoPauseAndResumeEnabled,
    boolean isGpsEnabled,
    @NonNull List<@NonNull ExerciseGoal<@NonNull ?>> exerciseGoals,
    @NonNull Bundle exerciseParams,
    @FloatRange(from = 0.0) float swimmingPoolLengthMeters,
    ExerciseTypeConfig exerciseTypeConfig,
    @NonNull Set<@NonNull BatchingMode> batchingModeOverrides,
    @NonNull Set<@NonNull ExerciseEventType<@NonNull ?>> exerciseEventTypes,
    @NonNull List<@NonNull DebouncedGoal<@NonNull ?>> debouncedGoals
)

Creates a new ExerciseConfig for an exercise tracked using Health Services

Public methods

builder

Added in 1.0.0
public static final @NonNull ExerciseConfig.Builder builder(@NonNull ExerciseType exerciseType)

Returns a fresh new Builder.

Parameters
@NonNull ExerciseType exerciseType

the ExerciseType representing this exercise

getBatchingModeOverrides

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

BatchingMode overrides for this exercise

getDataTypes

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

DataType which will be tracked for this exercise

getDebouncedGoals

Added in 1.1.0-alpha04
public final @NonNull List<@NonNull DebouncedGoal<@NonNull ?>> getDebouncedGoals()

DebouncedGoals for this exercise. DataTypes in DebouncedGoals must also be tracked.

getExerciseEventTypes

Added in 1.1.0-alpha04
public final @NonNull Set<@NonNull ExerciseEventType<@NonNull ?>> getExerciseEventTypes()

ExerciseEventTypes which should be tracked for this exercise

getExerciseGoals

Added in 1.0.0
public final @NonNull List<@NonNull ExerciseGoal<@NonNull ?>> getExerciseGoals()

ExerciseGoals for this exercise. DataTypes in ExerciseGoals must also be tracked (i.e. contained in dataTypes) in some form. For example, an ExerciseGoal for DataType.STEPS_TOTAL requires that dataTypes contains either or both of DataType.STEPS_TOTAL / DataType.STEPS.

getExerciseParams

Added in 1.0.0
public final @NonNull Bundle getExerciseParams()

Bundle bundle for specifying exercise presets, the values of an on-going exercise which can be used to pre-populate a new exercise.

getExerciseType

Added in 1.0.0
public final @NonNull ExerciseType getExerciseType()

ExerciseType user is performing for this exercise

getExerciseTypeConfig

Added in 1.0.0
public final ExerciseTypeConfig getExerciseTypeConfig()

ExerciseTypeConfig containing attributes which may be modified after the exercise has started

getSwimmingPoolLengthMeters

Added in 1.0.0
public final float getSwimmingPoolLengthMeters()

length (in meters) of the swimming pool, or 0 if not relevant to this exercise

isAutoPauseAndResumeEnabled

Added in 1.0.0
public final boolean isAutoPauseAndResumeEnabled()

whether auto-pause/resume is enabled for this exercise

isGpsEnabled

Added in 1.0.0
public final boolean isGpsEnabled()

whether GPS is enabled for this exercise. Must be set to true when DataType.LOCATION is present in dataTypes.

toString

public @NonNull String toString()