public enum HealthDataKind

  1. Object
  2. Enum<HealthDataKind>
  3. HealthDataKind

ImplementsComparable<HealthDataKind>

What shape of data a HealthDataType produces, and therefore which HealthSample subclass a query for it returns.

Enum constants

QUANTITYA numeric measurement with a unit – steps, heart rate, body mass.
CATEGORYAn enumerated observation with no natural unit – menstrual flow, a single sleep stage.
SERIESA run of measurements sharing one record identity – a beat-to-beat heart-rate trace.
SESSIONA bounded activity with child data – a workout, a night’s sleep.
COMPOSITEA reading made of several named values that only mean something together – a blood pressure, which is a systolic and a diastolic.

Methods

public static HealthDataKind[] values()
public static HealthDataKind valueOf(String name)

Inherited methods

Enum constant details

QUANTITY

QUANTITY
A numeric measurement with a unit – steps, heart rate, body mass. Produces QuantitySample. Maps to HKQuantitySample and to Health Connect’s numeric record types.

CATEGORY

CATEGORY
An enumerated observation with no natural unit – menstrual flow, a single sleep stage. Produces CategorySample. Maps to HKCategorySample.

SERIES

SERIES

A run of measurements sharing one record identity – a beat-to-beat heart-rate trace. Produces SeriesSample.

This kind exists because the two platforms disagree: Health Connect’s HeartRateRecord is one record containing N samples, while HealthKit returns N independent samples. See SampleQuery.setFlattenSeries(boolean).

SESSION

SESSION
A bounded activity with child data – a workout, a night’s sleep. Produces a SessionSample subclass.

COMPOSITE

COMPOSITE

A reading made of several named values that only mean something together – a blood pressure, which is a systolic and a diastolic. Produces BloodPressureSample.

It is not QUANTITY. Calling it one let generic code dispatch on the kind, cast a stored reading to QuantitySample and fail with a ClassCastException – and let a caller build a one-number quantity for a type that has no single number, which the platforms then had to refuse or, worse, store as half a reading.

Method details

values

public static HealthDataKind[] values()

valueOf

public static HealthDataKind valueOf(String name)