# ExerciseConfig

Artifact: [androidx.health:health-services-client](https://developer.android.com/jetpack/androidx/releases/health) [View Source](https://cs.android.com/search?q=file:androidx/health/services/client/data/ExerciseConfig.kt+class:androidx.health.services.client.data.ExerciseConfig) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

*** ** * ** ***


```
public final class ExerciseConfig
```

<br />

*** ** * ** ***

Defines configuration for an exercise tracked using Health Services.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig.Builder` Builder for `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig` instances. |

| ### Constants |
|---|---|
| `static final float` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#SWIMMING_POOL_LENGTH_UNSPECIFIED() = 0.0f` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#ExerciseConfig(androidx.health.services.client.data.ExerciseType,kotlin.collections.Set,kotlin.Boolean,kotlin.Boolean,kotlin.collections.List,android.os.Bundle,kotlin.Float,androidx.health.services.client.data.ExerciseTypeConfig,kotlin.collections.Set,kotlin.collections.Set,kotlin.collections.List)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseType exerciseType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/DataType<@https://developer.android.com/reference/androidx/annotation/NonNull ?, @https://developer.android.com/reference/androidx/annotation/NonNull ?>> dataTypes, boolean isAutoPauseAndResumeEnabled, boolean isGpsEnabled, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> exerciseGoals, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html exerciseParams, @https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0) float swimmingPoolLengthMeters, https://developer.android.com/reference/androidx/health/services/client/data/ExerciseTypeConfig exerciseTypeConfig, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/BatchingMode> batchingModeOverrides, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseEventType<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> exerciseEventTypes, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/DebouncedGoal<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> debouncedGoals )` Creates a new ExerciseConfig for an exercise tracked using Health Services |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig.Builder` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#builder(androidx.health.services.client.data.ExerciseType)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseType exerciseType)` Returns a fresh new `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig.Builder`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/BatchingMode>` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#getBatchingModeOverrides()()` `https://developer.android.com/reference/androidx/health/services/client/data/BatchingMode` overrides for this exercise |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/DataType<@https://developer.android.com/reference/androidx/annotation/NonNull ?, @https://developer.android.com/reference/androidx/annotation/NonNull ?>>` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#getDataTypes()()` `https://developer.android.com/reference/androidx/health/services/client/data/DataType` which will be tracked for this exercise |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/DebouncedGoal<@https://developer.android.com/reference/androidx/annotation/NonNull ?>>` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#getDebouncedGoals()()` `https://developer.android.com/reference/androidx/health/services/client/data/DebouncedGoal`s for this exercise. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseEventType<@https://developer.android.com/reference/androidx/annotation/NonNull ?>>` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#getExerciseEventTypes()()` `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseEventType`s which should be tracked for this exercise |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal<@https://developer.android.com/reference/androidx/annotation/NonNull ?>>` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#getExerciseGoals()()` `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal`s for this exercise. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#getExerciseParams()()` `https://developer.android.com/reference/android/os/Bundle.html` bundle for specifying exercise presets, the values of an on-going exercise which can be used to pre-populate a new exercise. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseType` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#getExerciseType()()` `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseType` user is performing for this exercise |
| `final https://developer.android.com/reference/androidx/health/services/client/data/ExerciseTypeConfig` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#getExerciseTypeConfig()()` `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseTypeConfig` containing attributes which may be modified after the exercise has started |
| `final float` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#getSwimmingPoolLengthMeters()()` length (in meters) of the swimming pool, or 0 if not relevant to this exercise |
| `final boolean` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#isAutoPauseAndResumeEnabled()()` whether auto-pause/resume is enabled for this exercise |
| `final boolean` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#isGpsEnabled()()` whether GPS is enabled for this exercise. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#toString()()` |

## 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](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

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

Returns a fresh new `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig.Builder`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/services/client/data/ExerciseType exerciseType` | the `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseType` representing this exercise |

### getBatchingModeOverrides

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
public final @NonNull Set<@NonNull BatchingMode> getBatchingModeOverrides()
```

`https://developer.android.com/reference/androidx/health/services/client/data/BatchingMode` overrides for this exercise

### getDataTypes

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
public final @NonNull Set<@NonNull DataType<@NonNull ?, @NonNull ?>> getDataTypes()
```

`https://developer.android.com/reference/androidx/health/services/client/data/DataType` which will be tracked for this exercise

### getDebouncedGoals

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health#1.1.0)

```
public final @NonNull List<@NonNull DebouncedGoal<@NonNull ?>> getDebouncedGoals()
```

`https://developer.android.com/reference/androidx/health/services/client/data/DebouncedGoal`s for this exercise. `https://developer.android.com/reference/androidx/health/services/client/data/DataType`s in `https://developer.android.com/reference/androidx/health/services/client/data/DebouncedGoal`s must also be tracked.

### getExerciseEventTypes

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health#1.1.0)

```
public final @NonNull Set<@NonNull ExerciseEventType<@NonNull ?>> getExerciseEventTypes()
```

`https://developer.android.com/reference/androidx/health/services/client/data/ExerciseEventType`s which should be tracked for this exercise

### getExerciseGoals

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
public final @NonNull List<@NonNull ExerciseGoal<@NonNull ?>> getExerciseGoals()
```

`https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal`s for this exercise. `https://developer.android.com/reference/androidx/health/services/client/data/DataType`s in `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal`s must also be tracked (i.e. contained in `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#dataTypes()`) in some form. For example, an `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseGoal` for `https://developer.android.com/reference/androidx/health/services/client/data/DataType#STEPS_TOTAL()` requires that `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#dataTypes()` contains either or both of `https://developer.android.com/reference/androidx/health/services/client/data/DataType#STEPS_TOTAL()` / `https://developer.android.com/reference/androidx/health/services/client/data/DataType#STEPS()`.

### getExerciseParams

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
public final @NonNull Bundle getExerciseParams()
```

`https://developer.android.com/reference/android/os/Bundle.html` 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](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
public final @NonNull ExerciseType getExerciseType()
```

`https://developer.android.com/reference/androidx/health/services/client/data/ExerciseType` user is performing for this exercise

### getExerciseTypeConfig

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
public final ExerciseTypeConfig getExerciseTypeConfig()
```

`https://developer.android.com/reference/androidx/health/services/client/data/ExerciseTypeConfig` containing attributes which may be modified after the exercise has started

### getSwimmingPoolLengthMeters

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#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](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
public final boolean isAutoPauseAndResumeEnabled()
```

whether auto-pause/resume is enabled for this exercise

### isGpsEnabled

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/health#1.0.0)

```
public final boolean isGpsEnabled()
```

whether GPS is enabled for this exercise. Must be set to `true` when `https://developer.android.com/reference/androidx/health/services/client/data/DataType#LOCATION()` is present in `https://developer.android.com/reference/androidx/health/services/client/data/ExerciseConfig#dataTypes()`.

### toString

```
public @NonNull String toString()
```