class Metadata


Set of shared metadata fields for Record.

Summary

Constants

const Int

For actively recorded data by the user.

const Int

For passively recorded data by the app.

const Int

For manually entered data by the user.

const Int

Unknown recording method.

Public constructors

Metadata(
    id: String,
    dataOrigin: DataOrigin,
    lastModifiedTime: Instant,
    clientRecordId: String?,
    clientRecordVersion: Long,
    device: Device?,
    recordingMethod: Int
)

Public functions

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

String?

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

Long

Optional client supplied version associated with the data.

DataOrigin

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

Device?

Optional client supplied device information associated with the data.

String

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

Instant

Automatically populated to when data was last modified (or originally created).

Int

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

Constants

RECORDING_METHOD_ACTIVELY_RECORDED

const val RECORDING_METHOD_ACTIVELY_RECORDED = 1: Int

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.

RECORDING_METHOD_AUTOMATICALLY_RECORDED

const val RECORDING_METHOD_AUTOMATICALLY_RECORDED = 2: Int

For passively recorded data by the app.

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

RECORDING_METHOD_MANUAL_ENTRY

const val RECORDING_METHOD_MANUAL_ENTRY = 3: Int

For manually entered data 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 constructors

Metadata

Added in 1.1.0-alpha10
Metadata(
    id: String = EMPTY_ID,
    dataOrigin: DataOrigin = DataOrigin(""),
    lastModifiedTime: Instant = Instant.EPOCH,
    clientRecordId: String? = null,
    clientRecordVersion: Long = 0,
    device: Device? = null,
    recordingMethod: Int = RECORDING_METHOD_UNKNOWN
)

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-alpha10
val clientRecordIdString?

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.

clientRecordVersion

Added in 1.1.0-alpha10
val clientRecordVersionLong

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 also
clientRecordId

dataOrigin

Added in 1.1.0-alpha10
val dataOriginDataOrigin

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.

device

Added in 1.1.0-alpha10
val deviceDevice?

Optional client supplied device information associated with the data.

id

Added in 1.1.0-alpha10
val idString

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.

lastModifiedTime

Added in 1.1.0-alpha10
val lastModifiedTimeInstant

Automatically populated to 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.

recordingMethod

Added in 1.1.0-alpha10
val recordingMethodInt

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

It should be one of the following: RECORDING_METHOD_UNKNOWN, RECORDING_METHOD_ACTIVELY_RECORDED, RECORDING_METHOD_AUTOMATICALLY_RECORDED and RECORDING_METHOD_MANUAL_ENTRY.