# 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)

*** ** * ** ***


```
public final class Metadata
```

<br />

*** ** * ** ***

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

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_ACTIVELY_RECORDED() = 1` For data actively recorded by the user. |
| `static final int` | `https://developer.android.com/reference/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. |
| `static final int` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_MANUAL_ENTRY() = 3` For data manually entered by the user. |
| `static final int` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_UNKNOWN() = 0` Unknown recording method. |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#activelyRecorded(androidx.health.connect.client.records.metadata.Device)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device)` Creates Metadata for an actively recorded record. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#activelyRecorded(androidx.health.connect.client.records.metadata.Device,kotlin.String,kotlin.Long)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html clientRecordId, long clientRecordVersion )` Creates Metadata for an actively recorded record with the provided client ID. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#activelyRecordedWithId(kotlin.String,androidx.health.connect.client.records.metadata.Device)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device)` Creates Metadata to update a record with an existing UUID. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#autoRecorded(androidx.health.connect.client.records.metadata.Device)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device)` Creates Metadata for an automatically recorded record. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#autoRecorded(androidx.health.connect.client.records.metadata.Device,kotlin.String,kotlin.Long)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html clientRecordId, long clientRecordVersion )` Creates Metadata for an automatically recorded record with the provided client ID. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#autoRecordedWithId(kotlin.String,androidx.health.connect.client.records.metadata.Device)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device)` Creates Metadata to update a record with an existing UUID. |
| `boolean` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#getClientRecordId()()` Optional client supplied record unique data identifier associated with the data. |
| `final long` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#getClientRecordVersion()()` Optional client supplied version associated with the data. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/DataOrigin` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#getDataOrigin()()` Where the data comes from, such as application information originally generated this data. |
| `final https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#getDevice()()` Optional client supplied device information associated with the data. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#getId()()` Unique identifier of this data, assigned by Health Connect at insertion time. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#getLastModifiedTime()()` Automatically populated to when data was last modified (or originally created). |
| `final int` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#getRecordingMethod()()` Client supplied data recording method to help to understand how the data was recorded. |
| `int` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#hashCode()()` |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#manualEntry(androidx.health.connect.client.records.metadata.Device)(https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device)` Creates Metadata for a manually entered record. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#manualEntry(kotlin.String,kotlin.Long,androidx.health.connect.client.records.metadata.Device)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html clientRecordId, long clientRecordVersion, https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device )` Creates Metadata for a manually entered record with the provided client ID. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#manualEntryWithId(kotlin.String,androidx.health.connect.client.records.metadata.Device)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id, https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device)` Creates Metadata to update a record with an existing UUID. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#toString()()` |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#unknownRecordingMethod(androidx.health.connect.client.records.metadata.Device)(https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device)` Creates Metadata with unknown recording method. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#unknownRecordingMethod(kotlin.String,kotlin.Long,androidx.health.connect.client.records.metadata.Device)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html clientRecordId, long clientRecordVersion, https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device )` Creates Metadata with unknown recording method with the provided client ID. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#unknownRecordingMethodWithId(kotlin.String,androidx.health.connect.client.records.metadata.Device)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id, https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device)` Creates Metadata to update a record with an existing UUID. |

| ### Extension functions |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/MetadataTestHelper.https://developer.android.com/reference/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)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/DataOrigin dataOrigin, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html lastModifiedTime )` Creates a new `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` object by copying existing fields and overriding specified properties for testing. |

## Constants

### RECORDING_METHOD_ACTIVELY_RECORDED

```
public static final int RECORDING_METHOD_ACTIVELY_RECORDED = 1
```

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/androidx/health/connect/client/records/metadata/Metadata#device()` must be specified when using this recording method.

### RECORDING_METHOD_AUTOMATICALLY_RECORDED

```
public static final int RECORDING_METHOD_AUTOMATICALLY_RECORDED = 2
```

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/androidx/health/connect/client/records/metadata/Metadata#device()` must be specified when using this recording method.

### RECORDING_METHOD_MANUAL_ENTRY

```
public static final int RECORDING_METHOD_MANUAL_ENTRY = 3
```

For data manually entered by the user.

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

### RECORDING_METHOD_UNKNOWN

```
public static final int RECORDING_METHOD_UNKNOWN = 0
```

Unknown recording method.

## Public methods

### activelyRecorded

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

```
public static final @NonNull Metadata activelyRecorded(@NonNull Device device)
```

Creates Metadata for an actively recorded record.

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device` | The `https://developer.android.com/reference/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)

```
public static final @NonNull Metadata activelyRecorded(
    @NonNull Device device,
    @NonNull String clientRecordId,
    long clientRecordVersion
)
```

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

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device` | The `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device` associated with the record. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html clientRecordId` | The client ID of the record. |
| `long clientRecordVersion` | 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)

```
public static final @NonNull Metadata activelyRecordedWithId(@NonNull String id, @NonNull Device device)
```

Creates Metadata to update a record with an existing UUID.

`https://developer.android.com/reference/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id` | The existing UUID of the record. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device` | The `https://developer.android.com/reference/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)

```
public static final @NonNull Metadata autoRecorded(@NonNull Device device)
```

Creates Metadata for an automatically recorded record.

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device` | The `https://developer.android.com/reference/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)

```
public static final @NonNull Metadata autoRecorded(
    @NonNull Device device,
    @NonNull String clientRecordId,
    long clientRecordVersion
)
```

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

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device` | The `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device` associated with the record. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html clientRecordId` | The client ID of the record. |
| `long clientRecordVersion` | 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)

```
public static final @NonNull Metadata autoRecordedWithId(@NonNull String id, @NonNull Device device)
```

Creates Metadata to update a record with an existing UUID.

`https://developer.android.com/reference/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id` | The existing UUID of the record. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device` | The `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device` associated with the record. |

### equals

```
public boolean equals(Object other)
```

### getClientRecordId

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

```
public final String getClientRecordId()
```

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/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/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)` |   |

### getClientRecordVersion

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

```
public final long getClientRecordVersion()
```

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/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/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/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/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)` |   |

### getDataOrigin

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

```
public final @NonNull DataOrigin getDataOrigin()
```

Where the data comes from, such as application information originally generated this data. When `https://developer.android.com/reference/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.

### getDevice

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

```
public final Device getDevice()
```

Optional client supplied device information associated with the data.

### getId

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

```
public final @NonNull String getId()
```

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

### getLastModifiedTime

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

```
public final @NonNull Instant getLastModifiedTime()
```

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

### getRecordingMethod

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

```
public final int getRecordingMethod()
```

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/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_UNKNOWN()`, `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_ACTIVELY_RECORDED()`, `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_AUTOMATICALLY_RECORDED()` and `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata#RECORDING_METHOD_MANUAL_ENTRY()`.

Value is one of the following:

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

<br />

### hashCode

```
public int hashCode()
```

### manualEntry

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

```
public static final @NonNull Metadata manualEntry(Device device)
```

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

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device` | The optional `https://developer.android.com/reference/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)

```
public static final @NonNull Metadata manualEntry(
    @NonNull String clientRecordId,
    long clientRecordVersion,
    Device device
)
```

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

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html clientRecordId` | The client ID of the record. |
| `long clientRecordVersion` | The client version of the record (default: 0). |
| `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device` | The optional `https://developer.android.com/reference/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)

```
public static final @NonNull Metadata manualEntryWithId(@NonNull String id, Device device)
```

Creates Metadata to update a record with an existing UUID.

`https://developer.android.com/reference/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id` | The existing UUID of the record. |
| `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device` | The optional `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device` associated with the recording. |

### toString

```
public @NonNull String toString()
```

### unknownRecordingMethod

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

```
public static final @NonNull Metadata unknownRecordingMethod(Device device)
```

Creates Metadata with unknown recording method.

`https://developer.android.com/reference/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 |
|---|---|
| `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device` | The optional `https://developer.android.com/reference/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)

```
public static final @NonNull Metadata unknownRecordingMethod(
    @NonNull String clientRecordId,
    long clientRecordVersion,
    Device device
)
```

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

`https://developer.android.com/reference/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html clientRecordId` | The client ID of the record. |
| `long clientRecordVersion` | The client version of the record (default: 0). |
| `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device` | The optional `https://developer.android.com/reference/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)

```
public static final @NonNull Metadata unknownRecordingMethodWithId(@NonNull String id, Device device)
```

Creates Metadata to update a record with an existing UUID.

`https://developer.android.com/reference/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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id` | The existing UUID of the record. |
| `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device device` | The optional `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Device` associated with the record. |

## Extension functions

### MetadataTestHelper.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)

```
public final @NonNull Metadata MetadataTestHelper.populatedWithTestValues(
    @NonNull Metadata receiver,
    @NonNull String id,
    @NonNull DataOrigin dataOrigin,
    @NonNull Instant lastModifiedTime
)
```

Creates a new `https://developer.android.com/reference/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/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/androidx/health/connect/client/records/metadata/Metadata` object based on the current instance, allowing the modification of the `id`, `dataOrigin`, and `lastModifiedTime` fields.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id` | The ID to assign to the new `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata`. If not provided, the ID from the current `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` instance will be used. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/DataOrigin dataOrigin` | The `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/DataOrigin` to assign to the new `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata`. If not provided, the data origin from the current `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` instance will be used. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html 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/androidx/health/connect/client/records/metadata/Metadata` instance will be used. |