Metadata.Builder


public static final class Metadata.Builder
extends Object

java.lang.Object
   ↳ android.health.connect.datatypes.Metadata.Builder


See also:

Summary

Public constructors

Builder()

Public methods

Metadata build()
Metadata.Builder setClientRecordId(String clientRecordId)

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

Metadata.Builder setClientRecordVersion(long clientRecordVersion)

Sets optional client supplied version associated with the data.

Metadata.Builder setDataOrigin(DataOrigin dataOrigin)

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 setId(String id)

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

Metadata.Builder setLastModifiedTime(Instant lastModifiedTime)

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

Metadata.Builder setRecordingMethod(int recordingMethod)

Sets recording method for the Record.

Inherited methods

Public constructors

Builder

Added in API level 34
public Builder ()

Public methods

build

Added in API level 34
public Metadata build ()

Returns
Metadata Metadata object This value cannot be null.

setClientRecordId

Added in API level 34
public Metadata.Builder setClientRecordId (String clientRecordId)

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.

Returns
Metadata.Builder

setClientRecordVersion

Added in API level 34
public Metadata.Builder setClientRecordVersion (long clientRecordVersion)

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

Parameters
clientRecordVersion long

Returns
Metadata.Builder This value cannot be null.

setDataOrigin

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

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.

Returns
Metadata.Builder This value cannot be null.

setDevice

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

Sets optional client supplied device information associated with the data.

Parameters
device Device: This value cannot be null.

Returns
Metadata.Builder This value cannot be null.

setId

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

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.

Returns
Metadata.Builder This value cannot be null.

setLastModifiedTime

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

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.

Returns
Metadata.Builder This value cannot be null.

setRecordingMethod

Added in API level 34
public Metadata.Builder setRecordingMethod (int recordingMethod)

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 Metadata.RECORDING_METHOD_UNKNOWN, Metadata.RECORDING_METHOD_ACTIVELY_RECORDED, Metadata.RECORDING_METHOD_AUTOMATICALLY_RECORDED, or Metadata.RECORDING_METHOD_MANUAL_ENTRY

Returns
Metadata.Builder This value cannot be null.