Added in API level 34

Builder


class Builder
kotlin.Any
   ↳ android.health.connect.datatypes.Metadata.Builder

Summary

Public constructors

Public methods
Metadata

Metadata.Builder
setClientRecordId(clientRecordId: String?)

Sets optional client supplied record unique data identifier associated with the data.

Metadata.Builder
setClientRecordVersion(clientRecordVersion: Long)

Sets optional client supplied version associated with the data.

Metadata.Builder

Sets where the data comes from, such as application information originally generated this data.

Metadata.Builder
setDevice(device: Device)

Sets optional client supplied device information associated with the data.

Metadata.Builder

Sets unique identifier of this data, assigned by the Android Health Platform at insertion time.

Metadata.Builder
setLastModifiedTime(lastModifiedTime: Instant)

Sets when data was last modified (or originally created).

Metadata.Builder
setRecordingMethod(recordingMethod: Int)

Sets recording method for the Record.

Public constructors

Builder

Added in API level 34
Builder()

Public methods

build

Added in API level 34
fun build(): Metadata
Return
Metadata Metadata object This value cannot be null.

setClientRecordId

Added in API level 34
fun setClientRecordId(clientRecordId: String?): Metadata.Builder

Sets 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 clientRecordVersion. @see clientRecordVersion

A null value means that no clientRecordId is set

Parameters
clientRecordId String?: This value may be null.

setClientRecordVersion

Added in API level 34
fun setClientRecordVersion(clientRecordVersion: Long): Metadata.Builder

Sets optional client supplied version associated with the data. This determines conflict resolution outcome when there are multiple insertions of the same clientRecordId. Data with the highest clientRecordVersion takes precedence. clientRecordVersion starts with 0. @see clientRecordId

Return
Metadata.Builder This value cannot be null.

setDataOrigin

Added in API level 34
fun setDataOrigin(dataOrigin: DataOrigin): Metadata.Builder

Sets where the data comes from, such as application information originally generated this data. When 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.

Parameters
dataOrigin DataOrigin: This value cannot be null.
Return
Metadata.Builder This value cannot be null.

setDevice

Added in API level 34
fun setDevice(device: Device): Metadata.Builder

Sets optional client supplied device information associated with the data.

Parameters
device Device: This value cannot be null.
Return
Metadata.Builder This value cannot be null.

setId

Added in API level 34
fun setId(id: String): Metadata.Builder

Sets unique identifier of this data, assigned by the Android Health Platform at insertion time. When Record is created before insertion, this takes a sentinel value, any assigned value will be ignored.

Parameters
id String: This value cannot be null.
Return
Metadata.Builder This value cannot be null.

setLastModifiedTime

Added in API level 34
fun setLastModifiedTime(lastModifiedTime: Instant): Metadata.Builder

Sets when data was last modified (or originally created). When Record is created before inserted, this contains a sentinel value, any assigned value will be ignored.

Parameters
lastModifiedTime Instant: This value cannot be null.
Return
Metadata.Builder This value cannot be null.

setRecordingMethod

Added in API level 34
fun setRecordingMethod(recordingMethod: Int): Metadata.Builder

Sets recording method for the Record. This detail helps to know how the data was recorded which can be useful for prioritization of the record

Parameters
recordingMethod Int: Value is android.health.connect.datatypes.Metadata#RECORDING_METHOD_UNKNOWN, android.health.connect.datatypes.Metadata#RECORDING_METHOD_ACTIVELY_RECORDED, android.health.connect.datatypes.Metadata#RECORDING_METHOD_AUTOMATICALLY_RECORDED, or android.health.connect.datatypes.Metadata#RECORDING_METHOD_MANUAL_ENTRY
Return
Metadata.Builder This value cannot be null.