Metadata
  public
  
  final
  
  class
  Metadata
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.health.connect.datatypes.Metadata | 
Set of shared metadata fields for Record
Summary
Nested classes | |
|---|---|
        
        
        
        
        class | 
      
        Metadata.Builder
        
  | 
    
Constants | |
|---|---|
int | 
        
          RECORDING_METHOD_ACTIVELY_RECORDED
          For actively recorded data by the user.  | 
    
int | 
        
          RECORDING_METHOD_AUTOMATICALLY_RECORDED
          For passively recorded data by the app.  | 
    
int | 
        
          RECORDING_METHOD_MANUAL_ENTRY
          For manually entered data by the user.  | 
    
int | 
        
          RECORDING_METHOD_UNKNOWN
          Unknown recording method.  | 
    
Public methods | |
|---|---|
        
        
        
        
        
        boolean
     | 
  
    
      
      equals(Object object)
      
      
        Indicates whether some other object is "equal to" this one.  | 
  
        
        
        
        
        
        String
     | 
  
    
      
      getClientRecordId()
      
      
     | 
  
        
        
        
        
        
        long
     | 
  
    
      
      getClientRecordVersion()
      
      
     | 
  
        
        
        
        
        
        DataOrigin
     | 
  
    
      
      getDataOrigin()
      
      
     | 
  
        
        
        
        
        
        Device
     | 
  
    
      
      getDevice()
      
      
     | 
  
        
        
        
        
        
        String
     | 
  
    
      
      getId()
      
      
     | 
  
        
        
        
        
        
        Instant
     | 
  
    
      
      getLastModifiedTime()
      
      
     | 
  
        
        
        
        
        
        int
     | 
  
    
      
      getRecordingMethod()
      
      
        Returns recording method which indicates how data was recorded for the   | 
  
        
        
        
        
        
        int
     | 
  
    
      
      hashCode()
      
      
        Returns a hash code value for the object.  | 
  
Inherited methods | |
|---|---|
Constants
RECORDING_METHOD_ACTIVELY_RECORDED
public static final int RECORDING_METHOD_ACTIVELY_RECORDED
For actively recorded data by the user.
For e.g. An exercise session actively recorded by the user using a phone or a watch device.
Constant Value: 1 (0x00000001)
RECORDING_METHOD_AUTOMATICALLY_RECORDED
public static final int RECORDING_METHOD_AUTOMATICALLY_RECORDED
For passively recorded data by the app.
For e.g. Steps data recorded by a watch or phone without the user starting a session.
Constant Value: 2 (0x00000002)
RECORDING_METHOD_MANUAL_ENTRY
public static final int RECORDING_METHOD_MANUAL_ENTRY
For manually entered data by the user.
For e.g. Nutrition or weight data entered by the user.
Constant Value: 3 (0x00000003)
RECORDING_METHOD_UNKNOWN
public static final int RECORDING_METHOD_UNKNOWN
Unknown recording method.
Constant Value: 0 (0x00000000)
Public methods
equals
public boolean equals (Object object)
Indicates whether some other object is "equal to" this one.
| Parameters | |
|---|---|
object | 
        
          Object: the reference object with which to compare.
 This value may be null. | 
      
| Returns | |
|---|---|
boolean | 
        true if this object is the same as the obj | 
      
getClientRecordId
public String getClientRecordId ()
| Returns | |
|---|---|
String | 
        Client record ID if set, null otherwise | 
getClientRecordVersion
public long getClientRecordVersion ()
| Returns | |
|---|---|
long | 
        Client record version if set, 0 otherwise | 
getDataOrigin
public DataOrigin getDataOrigin ()
| Returns | |
|---|---|
DataOrigin | 
        Corresponds to package name if set. If no data origin is set getDataOrigin().getPackageName() will return null | 
      
getDevice
public Device getDevice ()
| Returns | |
|---|---|
Device | 
        The device details that contributed to this record
 This value cannot be null. | 
      
getId
public String getId ()
| Returns | |
|---|---|
String | 
        Record identifier if set, empty string otherwise
 This value cannot be null. | 
      
getLastModifiedTime
public Instant getLastModifiedTime ()
| Returns | |
|---|---|
Instant | 
        Record's last modified time if set, Instant.EPOCH otherwise
 This value cannot be null. | 
      
getRecordingMethod
public int getRecordingMethod ()
Returns recording method which indicates how data was recorded for the Record
| Returns | |
|---|---|
int | 
        Value is RECORDING_METHOD_UNKNOWN, RECORDING_METHOD_ACTIVELY_RECORDED, RECORDING_METHOD_AUTOMATICALLY_RECORDED, or RECORDING_METHOD_MANUAL_ENTRY | 
      
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-02-10 UTC.