Health Connect supports more than 50 different data types that give users the ability to measure everything from their cycling speeds to their body temperature.
For a full list of available data types, please refer to the Jetpack reference.
Health Connect supports data types that are based on common usage to provide as much variety as possible. Health Connect aims to offer a comprehensive view and storage of health and fitness data. Before referring to the Jetpack reference, remember that Health Connect data types fall into the following categories:
- Activity: This captures any activity that a user does. It can include health and fitness activities like running, swimming, meditation, and sleep.
- Body Measurement: This captures common data related to the body. It includes capturing a user's weight, a user's basal metabolic rate, among other data types.
- Cycle Tracking: This captures menstrual cycles and related data points, such as the binary result of an ovulation test.
- Nutrition: This captures hydration and nutrition data types. The former represents how much water a user drank in a single drink. The latter includes many optional fields, such as calories, sugar and magnesium.
- Sleep: This captures interval data related to a user's length and type of sleep.
- Vitals: This captures essential information about the user's general health. It includes data such as blood glucose, body temperature and blood oxygen saturation.
Additional data attributes
Data in the Health Connect API also includes metadata attributes described in the following list:
- Health Connect ID: Each point of data is assigned with a unique identifier (UID) upon creation. This is useful for standard CRUD operations.
- Last Modified Time: This marks the timestamp the last instance a record has an update. It is automatically generated on the first creation of the record or on every update.
- Data Origin: Health Connect stores information about the application where the data came from. It tells you the package name of that origin where it is automatically added upon creation.
- Device: Health Connect stores information about the device where the data came from. It tells you the manufacturer and model of that device where you manually supply the value.
- Client ID: To help with conflict resolution and to make syncing easier, Health Connect provides Client IDs so that client applications can refer to data using their own IDs. This is supplied to the record manually.
- Client Record Version: Along with the Client ID, Health Connect provides versioning to help in tracking changes upon syncing. This is supplied to the record manually.
Unique identifier
Health Connect assigns UIDs to newly inserted data objects. This makes it possible to identify data objects and distinguish them from others, especially when used in read, update, or delete requests. UIDs are not identical to Client IDs. Client application assigns Client IDs, while Health Connect exclusively assigns UIDs.
Keep in mind that it's important to remember the following notes when working with UIDs in Health Connect:
- Sessions have a single UID but data within sessions have their own UIDs.
- UIDs are not tied or related to timestamps.
- Some use cases may require storing a specific UID during a workflow. For example, retrieving the data entry that the user just logged to display it back to them.
Time in Health Connect
All data written to Health Connect should specify zone offset information. Specifying zone offset enables applications reading the data to represent it in civil time. Civil time is the time that is local and relevant to the user, but not necessarily in Coordinated Universal Time (UTC).
In rare circumstances, zone offset may not be available. When this occurs, it is possible to write to Health Connect without specifying zone offset information. This should be avoided where possible.
Setting time and zone
Specifying zone offset information while writing data provides time zone information when reading data in Health Connect. However, it may fail to do so in certain situations, such as when the zone offset is not provided. Your app needs to be prepared to deal with both kinds of data, in a way that makes sense for your specific circumstances.
Permissions
Before requesting any permissions, your app must declare them in the manifest first. See the following tables for the full mapping of data types to permissions.
For 'alpha10' and higher
Record class type | Read and write permission declaration |
---|---|
ActiveCaloriesBurned | android.permission.health.READ_ACTIVE_CALORIES_BURNED android.permission.health.WRITE_ACTIVE_CALORIES_BURNED |
BasalBodyTemperature | android.permission.health.READ_BASAL_BODY_TEMPERATURE android.permission.health.WRITE_BASAL_BODY_TEMPERATURE |
BasalMetabolicRate | android.permission.health.READ_BASAL_METABOLIC_RATE android.permission.health.WRITE_BASAL_METABOLIC_RATE |
BloodGlucose | android.permission.health.READ_BLOOD_GLUCOSE android.permission.health.WRITE_BLOOD_GLUCOSE |
BloodPressure | android.permission.health.READ_BLOOD_PRESSURE android.permission.health.WRITE_BLOOD_PRESSURE |
BodyFat | android.permission.health.READ_BODY_FAT android.permission.health.WRITE_BODY_FAT |
BodyTemperature | android.permission.health.READ_BODY_TEMPERATURE android.permission.health.WRITE_BODY_TEMPERATURE |
BodyWaterMass | android.permission.health.READ_BODY_WATER_MASS android.permission.health.WRITE_BODY_WATER_MASS |
BoneMass | android.permission.health.READ_BONE_MASS android.permission.health.WRITE_BONE_MASS |
CervicalMucus | android.permission.health.READ_CERVICAL_MUCUS android.permission.health.WRITE_CERVICAL_MUCUS |
CyclingPedalingCadence | android.permission.health.READ_EXERCISE android.permission.health.WRITE_EXERCISE |
Distance | android.permission.health.READ_DISTANCE android.permission.health.WRITE_DISTANCE |
ElevationGained | android.permission.health.READ_ELEVATION_GAINED android.permission.health.WRITE_ELEVATION_GAINED |
ExerciseSession | android.permission.health.READ_EXERCISE android.permission.health.WRITE_EXERCISE |
FloorsClimbed | android.permission.health.READ_FLOORS_CLIMBED android.permission.health.WRITE_FLOORS_CLIMBED |
HeartRate | android.permission.health.READ_HEART_RATE android.permission.health.WRITE_HEART_RATE |
HeartRateVariabilityRmssd | android.permission.health.READ_HEART_RATE_VARIABILITY android.permission.health.WRITE_HEART_RATE_VARIABILITY |
Height | android.permission.health.READ_HEIGHT android.permission.health.WRITE_HEIGHT |
Hydration | android.permission.health.READ_HYDRATION android.permission.health.WRITE_HYDRATION |
IntermenstrualBleeding | android.permission.health.READ_INTERMENSTRUAL_BLEEDING android.permission.health.WRITE_INTERMENSTRUAL_BLEEDING |
LeanBodyMass | android.permission.health.READ_LEAN_BODY_MASS android.permission.health.WRITE_LEAN_BODY_MASS |
MenstruationFlow | android.permission.health.READ_MENSTRUATION android.permission.health.WRITE_MENSTRUATION |
MenstruationPeriod | android.permission.health.READ_MENSTRUATION android.permission.health.WRITE_MENSTRUATION |
Nutrition | android.permission.health.READ_NUTRITION android.permission.health.WRITE_NUTRITION |
OvulationTest | android.permission.health.READ_OVULATION_TEST android.permission.health.WRITE_OVULATION_TEST |
OxygenSaturation | android.permission.health.READ_OXYGEN_SATURATION android.permission.health.WRITE_OXYGEN_SATURATION |
Power | android.permission.health.READ_POWER android.permission.health.WRITE_POWER |
RespiratoryRate | android.permission.health.READ_RESPIRATORY_RATE android.permission.health.WRITE_RESPIRATORY_RATE |
RestingHeartRate | android.permission.health.READ_RESTING_HEART_RATE android.permission.health.WRITE_RESTING_HEART_RATE |
SexualActivity | android.permission.health.READ_SEXUAL_ACTIVITY android.permission.health.WRITE_SEXUAL_ACTIVITY |
SleepSession | android.permission.health.READ_SLEEP android.permission.health.WRITE_SLEEP |
SleepStage | android.permission.health.READ_SLEEP android.permission.health.WRITE_SLEEP |
Speed | android.permission.health.READ_SPEED android.permission.health.WRITE_SPEED |
StepsCadence | android.permission.health.READ_STEPS android.permission.health.WRITE_STEPS |
Steps | android.permission.health.READ_STEPS android.permission.health.WRITE_STEPS |
TotalCaloriesBurned | android.permission.health.READ_TOTAL_CALORIES_BURNED android.permission.health.WRITE_TOTAL_CALORIES_BURNED |
Vo2Max | android.permission.health.READ_VO2_MAX android.permission.health.WRITE_VO2_MAX |
Weight | android.permission.health.READ_WEIGHT android.permission.health.WRITE_WEIGHT |
WheelchairPushes | android.permission.health.READ_WHEELCHAIR_PUSHES android.permission.health.WRITE_WHEELCHAIR_PUSHES |
For 'alpha09' and lower
Record class type | Read and write permission declaration |
---|---|
ActiveCaloriesBurned | androidx.health.permission.ActiveCaloriesBurned.READ androidx.health.permission.ActiveCaloriesBurned.WRITE |
BasalBodyTemperature | androidx.health.permission.BasalBodyTemperature.READ androidx.health.permission.BasalBodyTemperature.WRITE |
BasalMetabolicRate | androidx.health.permission.BasalMetabolicRate.READ androidx.health.permission.BasalMetabolicRate.WRITE |
BloodGlucose | androidx.health.permission.BloodGlucose.READ androidx.health.permission.BloodGlucose.WRITE |
BloodPressure | androidx.health.permission.BloodPressure.READ androidx.health.permission.BloodPressure.WRITE |
BodyFat | androidx.health.permission.BodyFat.READ androidx.health.permission.BodyFat.WRITE |
BodyTemperature | androidx.health.permission.BodyTemperature.READ androidx.health.permission.BodyTemperature.WRITE |
BodyWaterMass | androidx.health.permission.BodyWaterMass.READ androidx.health.permission.BodyWaterMass.WRITE |
BoneMass | androidx.health.permission.BoneMass.READ androidx.health.permission.BoneMass.WRITE |
CervicalMucus | androidx.health.permission.CervicalMucus.READ androidx.health.permission.CervicalMucus.WRITE |
CyclingPedalingCadence | androidx.health.permission.CyclingPedalingCadence.READ androidx.health.permission.CyclingPedalingCadence.WRITE |
Distance | androidx.health.permission.Distance.READ androidx.health.permission.Distance.WRITE |
ElevationGained | androidx.health.permission.ElevationGained.READ androidx.health.permission.ElevationGained.WRITE |
ExerciseSession | androidx.health.permission.ExerciseSession.READ androidx.health.permission.ExerciseSession.WRITE |
FloorsClimbed | androidx.health.permission.FloorsClimbed.READ androidx.health.permission.FloorsClimbed.WRITE |
HeartRate | androidx.health.permission.HeartRate.READ androidx.health.permission.HeartRate.WRITE |
HeartRateVariabilityRmssd | androidx.health.permission.HeartRateVariabilityRmssd.READ androidx.health.permission.HeartRateVariabilityRmssd.WRITE |
Height | androidx.health.permission.Height.READ androidx.health.permission.Height.WRITE |
Hydration | androidx.health.permission.Hydration.READ androidx.health.permission.Hydration.WRITE |
IntermenstrualBleeding | androidx.health.permission.IntermenstrualBleeding.READ androidx.health.permission.IntermenstrualBleeding.WRITE |
LeanBodyMass | androidx.health.permission.LeanBodyMass.READ androidx.health.permission.LeanBodyMass.WRITE |
MenstruationFlow | androidx.health.permission.MenstruationFlow.READ androidx.health.permission.MenstruationFlow.WRITE |
Nutrition | androidx.health.permission.Nutrition.READ androidx.health.permission.Nutrition.WRITE |
OvulationTest | androidx.health.permission.OvulationTest.READ androidx.health.permission.OvulationTest.WRITE |
OxygenSaturation | androidx.health.permission.OxygenSaturation.READ androidx.health.permission.OxygenSaturation.WRITE |
Power | androidx.health.permission.Power.READ androidx.health.permission.Power.WRITE |
RespiratoryRate | androidx.health.permission.RespiratoryRate.READ androidx.health.permission.RespiratoryRate.WRITE |
RestingHeartRate | androidx.health.permission.RestingHeartRate.READ androidx.health.permission.RestingHeartRate.WRITE |
SexualActivity | androidx.health.permission.SexualActivity.READ androidx.health.permission.SexualActivity.WRITE |
SleepSession | androidx.health.permission.SleepSession.READ androidx.health.permission.SleepSession.WRITE |
SleepStage | androidx.health.permission.SleepSession.READ androidx.health.permission.SleepSession.WRITE |
Speed | androidx.health.permission.Speed.READ androidx.health.permission.Speed.WRITE |
StepsCadence | androidx.health.permission.StepsCadence.READ androidx.health.permission.StepsCadence.WRITE |
Steps | androidx.health.permission.Steps.READ androidx.health.permission.Steps.WRITE |
TotalCaloriesBurned | androidx.health.permission.TotalCaloriesBurned.READ androidx.health.permission.TotalCaloriesBurned.WRITE |
Vo2Max | androidx.health.permission.Vo2Max.READ androidx.health.permission.Vo2Max.WRITE |
Weight | androidx.health.permission.Weight.READ androidx.health.permission.Weight.WRITE |
WheelchairPushes | androidx.health.permission.WheelchairPushes.READ androidx.health.permission.WheelchairPushes.WRITE |