# Velocity

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/units/Velocity.kt+class:androidx.health.connect.client.units.Velocity) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

*** ** * ** ***


```
class Velocity : Comparable<Velocity>
```

<br />

*** ** * ** ***

Represents a unit of speed. Supported units:

- metersPerSecond - see `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#metersPerSecond(kotlin.Double)`, `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/package-summary#(kotlin.Double).metersPerSecond()`

- kilometersPerHour - see `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#kilometersPerHour(kotlin.Double)`, `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/package-summary#(kotlin.Double).kilometersPerHour()`

- milesPerHour - see `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#milesPerHour(kotlin.Double)`, `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/package-summary#(kotlin.Double).milesPerHour()`

## Summary

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#kilometersPerHour(kotlin.Double)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)` Creates `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity` with the specified value in kilometers per hour. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#metersPerSecond(kotlin.Double)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)` Creates `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity` with the specified value in meters per second. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#milesPerHour(kotlin.Double)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)` Creates `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity` with the specified value in miles per hour. |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#compareTo(androidx.health.connect.client.units.Velocity)(other: https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity)` |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#inKilometersPerHour()` Returns the velocity in kilometers per hour. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#inMetersPerSecond()` Returns the velocity in meters per second. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity#inMilesPerHour()` Returns the velocity in miles per hour. |

## Public companion functions

### kilometersPerHour

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

```
fun kilometersPerHour(value: Double): Velocity
```

Creates `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity` with the specified value in kilometers per hour.

### metersPerSecond

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

```
fun metersPerSecond(value: Double): Velocity
```

Creates `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity` with the specified value in meters per second.

### milesPerHour

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

```
fun milesPerHour(value: Double): Velocity
```

Creates `https://developer.android.com/reference/kotlin/androidx/health/connect/client/units/Velocity` with the specified value in miles per hour.

## Public functions

### compareTo

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

```
open operator fun compareTo(other: Velocity): Int
```

### equals

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

### hashCode

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

### toString

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

## Public properties

### inKilometersPerHour

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

```
val inKilometersPerHour: Double
```

Returns the velocity in kilometers per hour.

### inMetersPerSecond

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

```
val inMetersPerSecond: Double
```

Returns the velocity in meters per second.

### inMilesPerHour

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

```
val inMilesPerHour: Double
```

Returns the velocity in miles per hour.