# Metadata

Artifact: [androidx.health.connect:connect-client](https://developer.android.com/jetpack/androidx/releases/health-connect) [View Source](https://cs.android.com/search?q=file:androidx/health/connect/client/records/metadata/Metadata.kt+class:androidx.health.connect.client.records.metadata.Metadata) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

*** ** * ** ***


```
class Metadata
```

<br />

*** ** * ** ***

Set of shared metadata fields for `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/Record`.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_ACTIVELY_RECORDED() = 1` For data actively recorded by the user. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_AUTOMATICALLY_RECORDED() = 2` For data recorded passively by a device without user explicitly initiating the recording, or whenever it cannot be determined. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_MANUAL_ENTRY() = 3` For data manually entered by the user. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_UNKNOWN() = 0` Unknown recording method. |

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#activelyRecorded(androidx.health.connect.client.records.metadata.Device)(device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device)` Creates Metadata for an actively recorded record. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#activelyRecorded(androidx.health.connect.client.records.metadata.Device,kotlin.String,kotlin.Long)( device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device, clientRecordId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, clientRecordVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` Creates Metadata for an actively recorded record with the provided client ID. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#activelyRecordedWithId(kotlin.String,androidx.health.connect.client.records.metadata.Device)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device)` Creates Metadata to update a record with an existing UUID. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#autoRecorded(androidx.health.connect.client.records.metadata.Device)(device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device)` Creates Metadata for an automatically recorded record. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#autoRecorded(androidx.health.connect.client.records.metadata.Device,kotlin.String,kotlin.Long)( device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device, clientRecordId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, clientRecordVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` Creates Metadata for an automatically recorded record with the provided client ID. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#autoRecordedWithId(kotlin.String,androidx.health.connect.client.records.metadata.Device)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device)` Creates Metadata to update a record with an existing UUID. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#manualEntry(androidx.health.connect.client.records.metadata.Device)(device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device?)` Creates Metadata for a manually entered record. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#manualEntry(kotlin.String,kotlin.Long,androidx.health.connect.client.records.metadata.Device)( clientRecordId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, clientRecordVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device? )` Creates Metadata for a manually entered record with the provided client ID. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#manualEntryWithId(kotlin.String,androidx.health.connect.client.records.metadata.Device)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device?)` Creates Metadata to update a record with an existing UUID. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#unknownRecordingMethod(androidx.health.connect.client.records.metadata.Device)(device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device?)` Creates Metadata with unknown recording method. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#unknownRecordingMethod(kotlin.String,kotlin.Long,androidx.health.connect.client.records.metadata.Device)( clientRecordId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, clientRecordVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device? )` Creates Metadata with unknown recording method with the provided client ID. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#unknownRecordingMethodWithId(kotlin.String,androidx.health.connect.client.records.metadata.Device)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device?)` Creates Metadata to update a record with an existing UUID. |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#clientRecordId()` Optional client supplied record unique data identifier associated with the data. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#clientRecordVersion()` Optional client supplied version associated with the data. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/DataOrigin` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#dataOrigin()` Where the data comes from, such as application information originally generated this data. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device?` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#device()` Optional client supplied device information associated with the data. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#id()` Unique identifier of this data, assigned by Health Connect at insertion time. |
| `https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#lastModifiedTime()` Automatically populated to when data was last modified (or originally created). |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#recordingMethod()` Client supplied data recording method to help to understand how the data was recorded. |

| ### Extension functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata.https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#(androidx.health.connect.client.records.metadata.Metadata).populatedWithTestValues(kotlin.String,androidx.health.connect.client.records.metadata.DataOrigin,java.time.Instant)( id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, dataOrigin: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/DataOrigin, lastModifiedTime: https://developer.android.com/reference/java/time/Instant.html )` Creates a new `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` object by copying existing fields and overriding specified properties for testing. |

## Constants

### RECORDING_METHOD_ACTIVELY_RECORDED

```
const val RECORDING_METHOD_ACTIVELY_RECORDED = 1: Int
```

For data actively recorded by the user.

For e.g. An exercise session actively recorded by the user using a phone or a watch device.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#device()` must be specified when using this recording method.

### RECORDING_METHOD_AUTOMATICALLY_RECORDED

```
const val RECORDING_METHOD_AUTOMATICALLY_RECORDED = 2: Int
```

For data recorded passively by a device without user explicitly initiating the recording, or whenever it cannot be determined.

For e.g. Steps data recorded by a watch or phone without the user starting a session.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#device()` must be specified when using this recording method.

### RECORDING_METHOD_MANUAL_ENTRY

```
const val RECORDING_METHOD_MANUAL_ENTRY = 3: Int
```

For data manually entered by the user.

For e.g. Nutrition or weight data entered by the user.

### RECORDING_METHOD_UNKNOWN

```
const val RECORDING_METHOD_UNKNOWN = 0: Int
```

Unknown recording method.

## Public companion functions

### activelyRecorded

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
fun activelyRecorded(device: Device): Metadata
```

Creates Metadata for an actively recorded record.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_ACTIVELY_RECORDED()` is auto populated.

| Parameters |
|---|---|
| `device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` | The `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` associated with the record. |

### activelyRecorded

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
fun activelyRecorded(
    device: Device,
    clientRecordId: String,
    clientRecordVersion: Long = 0
): Metadata
```

Creates Metadata for an actively recorded record with the provided client ID.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_ACTIVELY_RECORDED()` is auto populated.

| Parameters |
|---|---|
| `device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` | The `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` associated with the record. |
| `clientRecordId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The client ID of the record. |
| `clientRecordVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = 0` | The client version of the record (default: 0). |

### activelyRecordedWithId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
fun activelyRecordedWithId(id: String, device: Device): Metadata
```

Creates Metadata to update a record with an existing UUID.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_ACTIVELY_RECORDED()` is auto populated.

Use this only when there's no client ID or version associated with the record.

| Parameters |
|---|---|
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The existing UUID of the record. |
| `device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` | The `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` associated with the record. |

### autoRecorded

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
fun autoRecorded(device: Device): Metadata
```

Creates Metadata for an automatically recorded record.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_AUTOMATICALLY_RECORDED()` is auto populated.

| Parameters |
|---|---|
| `device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` | The `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` associated with the record. |

### autoRecorded

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
fun autoRecorded(
    device: Device,
    clientRecordId: String,
    clientRecordVersion: Long = 0
): Metadata
```

Creates Metadata for an automatically recorded record with the provided client ID.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_AUTOMATICALLY_RECORDED()` is auto populated.

| Parameters |
|---|---|
| `device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` | The `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` associated with the record. |
| `clientRecordId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The client ID of the record. |
| `clientRecordVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = 0` | The client version of the record (default: 0). |

### autoRecordedWithId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
fun autoRecordedWithId(id: String, device: Device): Metadata
```

Creates Metadata to update a record with an existing UUID.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_AUTOMATICALLY_RECORDED()` is auto populated.

Use this only when there's no client ID or version associated with the record.

| Parameters |
|---|---|
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The existing UUID of the record. |
| `device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` | The `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` associated with the record. |

### manualEntry

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
fun manualEntry(device: Device? = null): Metadata
```

Creates Metadata for a manually entered record. Developers can provide optional device information.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_MANUAL_ENTRY()` is auto populated.

| Parameters |
|---|---|
| `device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device? = null` | The optional `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` associated with the record. |

### manualEntry

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
fun manualEntry(
    clientRecordId: String,
    clientRecordVersion: Long = 0,
    device: Device? = null
): Metadata
```

Creates Metadata for a manually entered record with the provided client ID. Developers can provide optional device information.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_MANUAL_ENTRY()` is auto populated.

| Parameters |
|---|---|
| `clientRecordId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The client ID of the record. |
| `clientRecordVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = 0` | The client version of the record (default: 0). |
| `device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device? = null` | The optional `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` associated with the record. |

### manualEntryWithId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
fun manualEntryWithId(id: String, device: Device? = null): Metadata
```

Creates Metadata to update a record with an existing UUID.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_MANUAL_ENTRY()` is auto populated.

Use this only when there's no client ID or version associated with the record.

| Parameters |
|---|---|
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The existing UUID of the record. |
| `device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device? = null` | The optional `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` associated with the recording. |

### unknownRecordingMethod

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
fun unknownRecordingMethod(device: Device? = null): Metadata
```

Creates Metadata with unknown recording method.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_UNKNOWN()` is auto populated.

This should only be used in the case when the recording method is geniously unknown.

| Parameters |
|---|---|
| `device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device? = null` | The optional `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` associated with the record. |

### unknownRecordingMethod

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
fun unknownRecordingMethod(
    clientRecordId: String,
    clientRecordVersion: Long = 0,
    device: Device? = null
): Metadata
```

Creates Metadata with unknown recording method with the provided client ID.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_UNKNOWN()` is auto populated.

This should only be used in the case when the recording method is geniously unknown.

| Parameters |
|---|---|
| `clientRecordId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The client ID of the record. |
| `clientRecordVersion: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = 0` | The client version of the record (default: 0). |
| `device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device? = null` | The optional `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` associated with the recording. |

### unknownRecordingMethodWithId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
fun unknownRecordingMethodWithId(id: String, device: Device? = null): Metadata
```

Creates Metadata to update a record with an existing UUID.

`https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_UNKNOWN()` is auto populated.

This should only be used in the case when the recording method is geniously unknown.

| Parameters |
|---|---|
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The existing UUID of the record. |
| `device: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device? = null` | The optional `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Device` associated with the record. |

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

```
open fun hashCode(): Int
```

### toString

```
open fun toString(): String
```

## Public properties

### clientRecordId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val clientRecordId: String?
```

Optional client supplied record unique data identifier associated with the data.

There is guaranteed a single entry for any type of data with same client provided identifier for a given client. Any new insertions with the same client provided identifier will either replace or be ignored depending on associated `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#(kotlin.Int,kotlin.String,androidx.health.connect.client.records.metadata.DataOrigin,java.time.Instant,kotlin.String,kotlin.Long,androidx.health.connect.client.records.metadata.Device)`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#(kotlin.Int,kotlin.String,androidx.health.connect.client.records.metadata.DataOrigin,java.time.Instant,kotlin.String,kotlin.Long,androidx.health.connect.client.records.metadata.Device)` |   |

### clientRecordVersion

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val clientRecordVersion: Long
```

Optional client supplied version associated with the data.

This determines conflict resolution outcome when there are multiple insertions of the same `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#(kotlin.Int,kotlin.String,androidx.health.connect.client.records.metadata.DataOrigin,java.time.Instant,kotlin.String,kotlin.Long,androidx.health.connect.client.records.metadata.Device)`. Data with the highest `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#(kotlin.Int,kotlin.String,androidx.health.connect.client.records.metadata.DataOrigin,java.time.Instant,kotlin.String,kotlin.Long,androidx.health.connect.client.records.metadata.Device)` takes precedence. `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#(kotlin.Int,kotlin.String,androidx.health.connect.client.records.metadata.DataOrigin,java.time.Instant,kotlin.String,kotlin.Long,androidx.health.connect.client.records.metadata.Device)` starts with 0.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#(kotlin.Int,kotlin.String,androidx.health.connect.client.records.metadata.DataOrigin,java.time.Instant,kotlin.String,kotlin.Long,androidx.health.connect.client.records.metadata.Device)` |   |

### dataOrigin

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val dataOrigin: DataOrigin
```

Where the data comes from, such as application information originally generated this data. When `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/Record` is created before insertion, this contains a sentinel value, any assigned value will be ignored. After insertion, this will be populated with inserted application.

### device

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val device: Device?
```

Optional client supplied device information associated with the data.

### id

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val id: String
```

Unique identifier of this data, assigned by Health Connect at insertion time. When `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/Record` is created before insertion, this takes a sentinel value, any assigned value will be ignored.

### lastModifiedTime

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val lastModifiedTime: Instant
```

Automatically populated to when data was last modified (or originally created). When `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/Record` is created before inserted, this contains a sentinel value, any assigned value will be ignored.

### recordingMethod

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val recordingMethod: Int
```

Client supplied data recording method to help to understand how the data was recorded.

It should be one of the following: `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_UNKNOWN()`, `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_ACTIVELY_RECORDED()`, `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_AUTOMATICALLY_RECORDED()` and `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_MANUAL_ENTRY()`.

Value is one of the following:

- `0`
- `1`
- `2`
- `3`

<br />

## Extension functions

### Metadata.populatedWithTestValues

Artifact: [androidx.health.connect:connect-testing](https://developer.android.com/jetpack/androidx/releases/health-connect) [View Source](https://cs.android.com/search?q=file:androidx/health/connect/client/testing/MetadataTestHelper.kt+function:populatedWithTestValues)

```
fun Metadata.populatedWithTestValues(
    id: String = this.id,
    dataOrigin: DataOrigin = this.dataOrigin,
    lastModifiedTime: Instant = this.lastModifiedTime
): Metadata
```

Creates a new `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` object by copying existing fields and overriding specified properties for testing.

This method facilitates the creation of `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` instances with controlled values, particularly useful for unit testing scenarios where specific metadata properties need to be set. It constructs a new `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` object based on the current instance, allowing the modification of the `id`, `dataOrigin`, and `lastModifiedTime` fields.

| Parameters |
|---|---|
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html = this.id` | The ID to assign to the new `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata`. If not provided, the ID from the current `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` instance will be used. |
| `dataOrigin: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/DataOrigin = this.dataOrigin` | The `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/DataOrigin` to assign to the new `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata`. If not provided, the data origin from the current `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` instance will be used. |
| `lastModifiedTime: https://developer.android.com/reference/java/time/Instant.html = this.lastModifiedTime` | The `https://developer.android.com/reference/java/time/Instant.html` representing the last modified time. If not provided, the last modified time from the current `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/metadata/Metadata` instance will be used. |