Skip to content
AF
Health Connect reference

ElevationGainedRecord: Health Connect elevation gained data

Read from Google’s documentation on 2026-10-03 · Google’s reference page last updated 2026-06-24

ElevationGainedRecord is Health Connect's elevation gained record — an Interval record in Google's Activity category. Its read permission is android.permission.health.READ_ELEVATION_GAINED; its write permission is android.permission.health.WRITE_ELEVATION_GAINED. It supports 1 aggregate metric (ELEVATION_GAINED_TOTAL). Mandatory fields per Google's table: elevation, endTime, metadata and startTime.

What Google says ElevationGainedRecord is

Captures the elevation gained by the user since the last reading.

Quoted from Google’s ElevationGainedRecord Jetpack reference, last updated 2026-06-24, read 2026-10-03.

Class
androidx.health.connect.client.records.ElevationGainedRecord
Google's category
Activity
Record type
Interval
Unit class
androidx.health.connect.client.units.Length
Mandatory fields
elevationendTimemetadatastartTime
Added in (Jetpack)
1.1.0

Permissions

The exact strings Google’s data-types table declares for ElevationGainedRecord. Google’s page: “Before requesting any permissions, your app must declare them in the manifest.”

AccessPermission stringFramework reference
Readandroid.permission.health.READ_ELEVATION_GAINEDAPI 34 · U Ext 7
Writeandroid.permission.health.WRITE_ELEVATION_GAINEDAPI 34 · U Ext 7
AndroidManifest.xml
<uses-permission android:name="android.permission.health.READ_ELEVATION_GAINED" />
<uses-permission android:name="android.permission.health.WRITE_ELEVATION_GAINED" />
Kotlin — the same strings from the Jetpack helper
import androidx.health.connect.client.permission.HealthPermission
import androidx.health.connect.client.records.ElevationGainedRecord

val permissions = setOf(
    HealthPermission.getReadPermission(ElevationGainedRecord::class),
    HealthPermission.getWritePermission(ElevationGainedRecord::class),
)

The 6 fields of ElevationGainedRecord

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.

FieldTypeAllowed rangeGoogle’s description
elevationmandatoryLengthValid range: -1000000-1000000 meters.Elevation in Length units. Required field. Valid range: -1000000-1000000 meters.
endTimemandatoryInstant—End time of the record.
endZoneOffsetZoneOffset?—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.
metadatamandatoryMetadata—Set of common metadata associated with the written record.
startTimemandatoryInstant—Start time of the record.
startZoneOffsetZoneOffset?—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 ElevationGainedRecord. The value type is the T in Google’s AggregateMetric<T> signature. Every aggregate metric across all records.

MetricValue typeGoogle’s description
ElevationGainedRecord.ELEVATION_GAINED_TOTALLengthMetric identifier to retrieve the total elevation gained 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 ElevationGainedRecord in Kotlin

The shape of Google’s own read example, with ElevationGainedRecord and its names filled in. Get the client with HealthConnectClient.getOrCreate(context) after checking getSdkStatus.

readRecords
import androidx.health.connect.client.HealthConnectClient
import androidx.health.connect.client.records.ElevationGainedRecord
import androidx.health.connect.client.request.ReadRecordsRequest
import androidx.health.connect.client.time.TimeRangeFilter
import java.time.Instant

suspend fun readElevationGained(
    client: HealthConnectClient,
    startTime: Instant,
    endTime: Instant,
): List<ElevationGainedRecord> {
    val response = client.readRecords(
        ReadRecordsRequest(
            ElevationGainedRecord::class,
            timeRangeFilter = TimeRangeFilter.between(startTime, endTime),
        )
    )
    // One page of up to pageSize records (default 1000); follow
    // response.pageToken for the rest.
    return response.records
}
aggregate
import androidx.health.connect.client.HealthConnectClient
import androidx.health.connect.client.records.ElevationGainedRecord
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 aggregateElevationGained(
    client: HealthConnectClient,
    startTime: Instant,
    endTime: Instant,
): Length? {
    val response = client.aggregate(
        AggregateRequest(
            metrics = setOf(ElevationGainedRecord.ELEVATION_GAINED_TOTAL),
            timeRangeFilter = TimeRangeFilter.between(startTime, endTime),
        )
    )
    // get() is declared as returning a nullable value.
    return response[ElevationGainedRecord.ELEVATION_GAINED_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 ElevationGainedRecord 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 ElevationGainedRecord 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 ElevationGainedRecord need?
Google's Health Connect data-types table (read 2026-10-03) declares android.permission.health.READ_ELEVATION_GAINED for reading ElevationGainedRecord and android.permission.health.WRITE_ELEVATION_GAINED for writing it, and says apps must declare permissions in the manifest before requesting them.
Which aggregate metrics does ElevationGainedRecord support?
Google's Jetpack reference defines 1 on ElevationGainedRecord: ELEVATION_GAINED_TOTAL (AggregateMetric<Length>). Pass it in the metrics set of an AggregateRequest and read it back from the AggregationResult.
What values does ElevationGainedRecord.elevation accept?
Google's reference types elevation as Length. Its description reads: "Elevation in Length units. Required field. Valid range: -1000000-1000000 meters."
Is ElevationGainedRecord an interval, instantaneous or series record?
Google's data-types table lists ElevationGainedRecord 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 elevation, endTime, metadata and startTime.

Other Activity records

All Activity records →

Sources checked

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.

← All Health Connect records · Every permission string