# 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)

*** ** * ** ***


```
public final class Velocity implements Comparable<@NonNull Velocity>
```

<br />

*** ** * ** ***

Represents a unit of speed. Supported units:

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

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

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

## Summary

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity#compareTo(androidx.health.connect.client.units.Velocity)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Velocity other)` |
| `boolean` | `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final double` | `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity#getKilometersPerHour()()` Returns the velocity in kilometers per hour. |
| `final double` | `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity#getMetersPerSecond()()` Returns the velocity in meters per second. |
| `final double` | `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity#getMilesPerHour()()` Returns the velocity in miles per hour. |
| `int` | `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity#hashCode()()` |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Velocity` | `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity#kilometersPerHour(kotlin.Double)(double value)` Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity` with the specified value in kilometers per hour. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Velocity` | `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity#metersPerSecond(kotlin.Double)(double value)` Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity` with the specified value in meters per second. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/units/Velocity` | `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity#milesPerHour(kotlin.Double)(double value)` Creates `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity` with the specified value in miles per hour. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/units/Velocity#toString()()` |

## Public methods

### compareTo

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

```
public int compareTo(@NonNull Velocity other)
```

### equals

```
public boolean equals(Object other)
```

### getKilometersPerHour

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

```
public final double getKilometersPerHour()
```

Returns the velocity in kilometers per hour.

### getMetersPerSecond

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

```
public final double getMetersPerSecond()
```

Returns the velocity in meters per second.

### getMilesPerHour

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

```
public final double getMilesPerHour()
```

Returns the velocity in miles per hour.

### hashCode

```
public int hashCode()
```

### kilometersPerHour

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

```
public static final @NonNull Velocity kilometersPerHour(double value)
```

Creates `https://developer.android.com/reference/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)

```
public static final @NonNull Velocity metersPerSecond(double value)
```

Creates `https://developer.android.com/reference/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)

```
public static final @NonNull Velocity milesPerHour(double value)
```

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

### toString

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