DistanceRecord
public final class DistanceRecord implements Record
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.
Summary
Public fields |
|
|---|---|
static final @NonNull AggregateMetric<@NonNull Length> |
Metric identifier to retrieve the total distance from |
Public constructors |
|---|
DistanceRecord( |
Public methods |
|
|---|---|
boolean |
|
final @NonNull Length |
Distance in |
@NonNull Instant |
End time of the record. |
ZoneOffset |
User experienced zone offset at |
@NonNull Metadata |
Set of common metadata associated with the written record. |
@NonNull Instant |
Start time of the record. |
ZoneOffset |
User experienced zone offset at |
int |
hashCode() |
@NonNull String |
toString() |
Public fields
DISTANCE_TOTAL
public static final @NonNull AggregateMetric<@NonNull Length> DISTANCE_TOTAL
Metric identifier to retrieve the total distance from androidx.health.connect.client.aggregate.AggregationResult.
Public constructors
DistanceRecord
public DistanceRecord(
@NonNull Instant startTime,
ZoneOffset startZoneOffset,
@NonNull Instant endTime,
ZoneOffset endZoneOffset,
@NonNull Length distance,
@NonNull Metadata metadata
)
Public methods
getDistance
public final @NonNull Length getDistance()
Distance in Length unit. Required field. Valid range: 0-1000000 meters.
getEndZoneOffset
public ZoneOffset getEndZoneOffset()
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.
getMetadata
public @NonNull Metadata getMetadata()
Set of common metadata associated with the written record.
getStartZoneOffset
public ZoneOffset getStartZoneOffset()
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.