# ExerciseCompletionGoal.DistanceAndDurationGoal

# ExerciseCompletionGoal.DistanceAndDurationGoal

Artifact:[androidx.health.connect:connect-client](https://developer.android.com/jetpack/androidx/releases/health-connect)  
[View Source](https://cs.android.com/search?q=file:androidx/health/connect/client/records/ExerciseCompletionGoal.kt+class:androidx.health.connect.client.records.ExerciseCompletionGoal.DistanceAndDurationGoal)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal "View this page in Java")

<br />

```
class ExerciseCompletionGoal.DistanceAndDurationGoal : ExerciseCompletionGoal
```

<br />

|---|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)                                                                                                                                                  |||
| ↳ | [androidx.health.connect.client.records.ExerciseCompletionGoal](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/ExerciseCompletionGoal)                                                    ||
|   | ↳ | [androidx.health.connect.client.records.ExerciseCompletionGoal.DistanceAndDurationGoal](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal) |

*** ** * ** ***

An[ExerciseCompletionGoal](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/ExerciseCompletionGoal)that requires covering a specified distance. Additionally, the step is not complete until the specified time has elapsed. Time remaining after the specified distance has been completed should be spent resting. In the context of swimming, this is sometimes referred to as 'interval training'.

For example, a swimming coach may specify '100m @ 1min40s'. This implies: complete 100m and if you manage it in 1min30s, you will have 10s of rest prior to the next set.

## Summary

|                                                                                                                                                                                                                       ### Public constructors                                                                                                                                                                                                                        |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DistanceAndDurationGoal](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal#DistanceAndDurationGoal(androidx.health.connect.client.units.Length,java.time.Duration))`(distance: `[Length](https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Length)`, duration: `[Duration](https://developer.android.com/reference/java/time/Duration.html)`)` |

|                                        ### Public functions                                         |
|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `open operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [equals](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal#equals(kotlin.Any))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` |
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                  | [hashCode](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal#hashCode())`()`                                                                                            |
| `open `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)            | [toString](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal#toString())`()`                                                                                            |

|                                        ### Public properties                                         |
|------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Length](https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Length) | [distance](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal#distance()) |
| [Duration](https://developer.android.com/reference/java/time/Duration.html)                          | [duration](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/ExerciseCompletionGoal.DistanceAndDurationGoal#duration()) |

## Public constructors

### DistanceAndDurationGoal

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

```
DistanceAndDurationGoal(distance: Length, duration: Duration)
```  

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```  

### hashCode

```
open fun hashCode(): Int
```  

### toString

```
open fun toString(): String
```  

## Public properties

### distance

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

```
val distance: Length
```  

### duration

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

```
val duration: Duration
```