DistanceRecord
  public
  
  final
  
  class
  DistanceRecord
  
  
  
  
  
  
  
    extends IntervalRecord
  
  
  
  
  
  
| java.lang.Object | |||
| ↳ | android.health.connect.datatypes.Record | ||
| ↳ | android.health.connect.datatypes.IntervalRecord | ||
| ↳ | android.health.connect.datatypes.DistanceRecord | ||
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
| Nested classes | |
|---|---|
| 
        
        
        
        
        class | DistanceRecord.BuilderBuilder class for  | 
| Fields | |
|---|---|
| 
    public
    static
    final
    AggregationType<Length> | DISTANCE_TOTALMetric identifier to get total distance using aggregate APIs in  | 
| Public methods | |
|---|---|
| 
        
        
        
        
        
        boolean | 
      equals(Object o)
      Indicates whether some other object is "equal to" this one. | 
| 
        
        
        
        
        
        Length | 
      getDistance()
       | 
| 
        
        
        
        
        
        int | 
      hashCode()
      Returns a hash code value for the object. | 
| Inherited methods | |
|---|---|
Fields
DISTANCE_TOTAL
public static final AggregationType<Length> DISTANCE_TOTAL
Metric identifier to get total distance using aggregate APIs in HealthConnectManager
Public methods
equals
public boolean equals (Object o)
Indicates whether some other object is "equal to" this one.
| Parameters | |
|---|---|
| o | Object: the reference object with which to compare.
 This value may benull. | 
| Returns | |
|---|---|
| boolean | trueif this object is the same as the obj | 
getDistance
public Length getDistance ()
| Returns | |
|---|---|
| Length | distance of this activity in Lengthunit
 This value cannot benull. | 
hashCode
public int hashCode ()
Returns a hash code value for the object.
| Returns | |
|---|---|
| int | a hash code value for this object. | 
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
