DistanceRecord: Health Connect distance data
Read from Google’s documentation on 2026-10-03 · Google’s reference page last updated 2026-06-24
DistanceRecord is Health Connect's distance record — an Interval record in Google's Activity category. Its read permission is android.permission.health.READ_DISTANCE; its write permission is android.permission.health.WRITE_DISTANCE. It supports 1 aggregate metric (DISTANCE_TOTAL). Mandatory fields per Google's table: distance, endTime, metadata and startTime.
What Google says DistanceRecord is
Captures distance travelled by the user since the last reading. The total distance over an interval can be calculated by adding together all the values during the interval. The start time of each record should represent the start of the interval in which the distance was covered.
If break downs are preferred in scenario of a long workout, consider writing multiple distance records. The start time of each record should be equal to or greater than the end time of the previous record.
Quoted from Google’s DistanceRecord Jetpack reference, last updated 2026-06-24, read 2026-10-03.
- Class
androidx.health.connect.client.records.DistanceRecord- Google's category
- Activity
- Record type
- Interval
- Unit class
androidx.health.connect.client.units.Length- Mandatory fields
distanceendTimemetadatastartTime- Added in (Jetpack)
1.1.0
Permissions
The exact strings Google’s data-types table declares for DistanceRecord. Google’s page: “Before requesting any permissions, your app must declare them in the manifest.”
| Access | Permission string | Framework reference |
|---|---|---|
| Read | android.permission.health.READ_DISTANCE | API 34 · U Ext 7 |
| Write | android.permission.health.WRITE_DISTANCE | API 34 · U Ext 7 |
<uses-permission android:name="android.permission.health.READ_DISTANCE" />
<uses-permission android:name="android.permission.health.WRITE_DISTANCE" />import androidx.health.connect.client.permission.HealthPermission
import androidx.health.connect.client.records.DistanceRecord
val permissions = setOf(
HealthPermission.getReadPermission(DistanceRecord::class),
HealthPermission.getWritePermission(DistanceRecord::class),
)The 6 fields of DistanceRecord
Types and descriptions as Google’s reference prints them. The range column quotes Google’s own range annotation or sentence; a dash means Google states none, which is not the same as no validation.
| Field | Type | Allowed range | Google’s description |
|---|---|---|---|
distancemandatory | Length | Valid range: 0-1000000 meters. | Distance in Length unit. Required field. Valid range: 0-1000000 meters. |
endTimemandatory | Instant | — | End time of the record. |
endZoneOffset | ZoneOffset? | — | User experienced zone offset at endTime, or null if unknown. Providing these will help history aggregations results stay consistent should user travel. Queries with user experienced time filters will assume system current zone offset if the information is absent. |
metadatamandatory | Metadata | — | Set of common metadata associated with the written record. |
startTimemandatory | Instant | — | Start time of the record. |
startZoneOffset | ZoneOffset? | — | User experienced zone offset at startTime, or null if unknown. Providing these will help history aggregations results stay consistent should user travel. Queries with user experienced time filters will assume system current zone offset if the information is absent. |
Aggregate metrics
The AggregateMetric constants Google defines on DistanceRecord. The value type is the T in Google’s AggregateMetric<T> signature. Every aggregate metric across all records.
| Metric | Value type | Google’s description |
|---|---|---|
| DistanceRecord.DISTANCE_TOTAL | Length | Metric identifier to retrieve the total distance from androidx.health.connect.client.aggregate.AggregationResult. |
Google’s read-data guide: “For cumulative types like StepsRecord, use aggregate() instead of readRecords() to avoid double counting from multiple sources and improve accuracy.” and “The aggregation API also contains logic to handle duplicate records, and lessens the chances of rate limiting.”
Read DistanceRecord in Kotlin
The shape of Google’s own read example, with DistanceRecord and its names filled in. Get the client with HealthConnectClient.getOrCreate(context) after checking getSdkStatus.
import androidx.health.connect.client.HealthConnectClient
import androidx.health.connect.client.records.DistanceRecord
import androidx.health.connect.client.request.ReadRecordsRequest
import androidx.health.connect.client.time.TimeRangeFilter
import java.time.Instant
suspend fun readDistance(
client: HealthConnectClient,
startTime: Instant,
endTime: Instant,
): List<DistanceRecord> {
val response = client.readRecords(
ReadRecordsRequest(
DistanceRecord::class,
timeRangeFilter = TimeRangeFilter.between(startTime, endTime),
)
)
// One page of up to pageSize records (default 1000); follow
// response.pageToken for the rest.
return response.records
}import androidx.health.connect.client.HealthConnectClient
import androidx.health.connect.client.records.DistanceRecord
import androidx.health.connect.client.request.AggregateRequest
import androidx.health.connect.client.time.TimeRangeFilter
import java.time.Instant
import androidx.health.connect.client.units.Length
suspend fun aggregateDistance(
client: HealthConnectClient,
startTime: Instant,
endTime: Instant,
): Length? {
val response = client.aggregate(
AggregateRequest(
metrics = setOf(DistanceRecord.DISTANCE_TOTAL),
timeRangeFilter = TimeRangeFilter.between(startTime, endTime),
)
)
// get() is declared as returning a nullable value.
return response[DistanceRecord.DISTANCE_TOTAL]
}Setting up the client, the permission flow and Play Console declaration: integrating Health Connect step by step.
HealthKit counterpart
No verified HealthKit counterpart. The cross-platform matrix only pairs metrics checked against both Apple’s and Google’s documentation, and DistanceRecord is not among them yet. A similarly named Apple type may exist on the HealthKit reference, but a name match is not a verified mapping.
The metric on other platforms
This guide lists DistanceRecord beside the types on the other platforms this site covers whose own descriptions name the same metric, each quoted, with how each one is read.
Questions
- What permission does DistanceRecord need?
- Google's Health Connect data-types table (read 2026-10-03) declares android.permission.health.READ_DISTANCE for reading DistanceRecord and android.permission.health.WRITE_DISTANCE for writing it, and says apps must declare permissions in the manifest before requesting them.
- Which aggregate metrics does DistanceRecord support?
- Google's Jetpack reference defines 1 on DistanceRecord: DISTANCE_TOTAL (AggregateMetric<Length>). Pass it in the metrics set of an AggregateRequest and read it back from the AggregationResult.
- What values does DistanceRecord.distance accept?
- Google's reference types distance as Length. Its description reads: "Distance in Length unit. Required field. Valid range: 0-1000000 meters."
- Is DistanceRecord an interval, instantaneous or series record?
- Google's data-types table lists DistanceRecord as Interval, and defines that column as indicating "whether the data is recorded at an instant in time or over an interval". Its mandatory fields are distance, endTime, metadata and startTime.
Other Activity records
Sources checked
- Google — DistanceRecord (Jetpack reference) — last updated 2026-06-24 · read 2026-10-03
- Google — Health Connect data types · read 2026-10-03
- Google — HealthPermissions (framework reference) · read 2026-10-03
- Google — Read raw data (Health Connect guide) · read 2026-10-03
Google’s descriptions are quoted for identification; the page layout, the capsule and the cross-platform pairing are AIFitnessAPI’s. Generated from Google’s pages by a script, not typed by hand — the same data is behind every page in the Health Connect reference.