Stay organized with collections Save and categorize content based on your preferences.

Health

  
Create performant health applications in a platform agnostic way.

This table lists all the artifacts in the androidx.health group.

Artifact Stable Release Release Candidate Beta Release Alpha Release
health-services-client - - - 1.0.0-alpha03
health-connect-client - - - 1.0.0-alpha03
This library was last updated on: July 27, 2022

Declaring dependencies

To add a dependency on Health, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

Groovy

dependencies {
    implementation "androidx.health:health-services-client:1.0.0-alpha03"
}

Kotlin

dependencies {
    implementation("androidx.health:health-services-client:1.0.0-alpha03")
}

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Health Connect Client Version 1.0

Version 1.0.0-alpha04

August 24, 2022

For versions 1.0.0-alpha04 and up, you can find the release notes on the Health Connect page.

Version 1.0.0-alpha03

July 27, 2022

androidx.health:health-connect-client:1.0.0-alpha03 is released. Version 1.0.0-alpha03 contains these commits.

New Features

  • Summary of new API changes: a set of units have been added to the read, write, aggregate APIs. Apps can now retrieve or write records with their unit of choice, such as grams or milligrams for NutritionRecord nutrients.

API Changes

  • Fix List<DataOrigin> to be Set<DataOrigin> across various request response objects. (I42342)
  • Fix unit of basal total calories from Power->Energy. (I0b429)
  • Moved series sample classes inside series records (Ica9bb):
    • CyclingPedalingCadence -> CyclingPedalingCadenceRecord.Sample
    • HeartRate -> HeartRateRecord.Sample
    • StepsCadence -> StepsCadenceRecord.Sample
  • Deprecate HealthDataRequestPermission class, in favor of PermissionController.createRequestPermissionActivityContract; This promotes better discoverability and unified parameterization. (I81e7f)
  • Added US fluid ounces to Volume. (I5f03d)
  • Added Speed unit type (I1d574)
  • Added Percentage unit type (I08f23)
  • Added Pressure unit type (Ifb01f)
  • Added Mass unit type (Ifd81a)
  • Added Volume unit type (I59ad1)
  • Added Power unit type. Moved Power series sample class inside PowerRecord class. (I5b1e5)
  • Added Energy unit type (I983ae)
  • Added Temperature unit type (I4cdb5)
  • Rename references of Activity to be specific to Exercise, including (I3f936):
    • Renamed ActivityLap -> ExerciseLapRecord
    • Renamed ActivityEvent -> ExerciseEventRecord
    • Renamed Repetitions -> ExerciseRepetitionsRecord
    • Renamed ActivitySession -> ExerciseSessionRecord
  • Moved package metadata nested under records. (Ie0835)
  • Used Length unit in all remaining records (Ib10dd):
    • ActivityLapRecord
    • ElevationGainedRecord
    • HeightRecord
    • HipCircumferenceRecord
    • WaistCircumferenceRecord
  • Added Length unit type (Idae39)
  • Update CervicalMucus description terminology (I25a2b):
    • CervicalMucus.Amount -> CervicalMucusRecord.Texture
    • CervicalMucus.Appearance -> CervicalMucusRecord.Sensation
  • Added 'Record' suffix to all record class names (I1ffc2)

Bug Fixes

  • Fix proguard issues when lib built with release flavor and minifyEnabled true. (I78933)
  • Hides documentation not intended for public usage. (I7a08f)
  • Fixes the issue in clients who may have their own protobuf dependencies.(https://android-review.googlesource.com/c/platform/frameworks/support/+/2105430)

Version 1.0.0-alpha02

June 1, 2022

androidx.health:health-connect-client:1.0.0-alpha02 is released. Version 1.0.0-alpha02 contains these commits.

API Changes

  • Deprecated hasMetric and getMetric in AggregationResult, added contains and get operators (I7cc7c)
  • Adds OvulationTest.Result.HIGH and OvulationTest.Result.INCONCLUSIVE. (I9f9c4)

Bug Fixes

  • Reduce SDK requirements to 26. (I6d201)

Version 1.0.0-alpha01

May 11, 2022

androidx.health:health-connect-client:1.0.0-alpha01 is released. Version 1.0.0-alpha01 contains these commits.

New Features

  • API for reading fitness and health records shared by other apps.
  • API for writing fitness and health records to share with other apps.
  • API to retrieve aggregated metrics for accessible records.
  • API to retrieve incremental changes (insert, update or delete) of records by other apps.
  • API to prompt users for health permissions.
  • API to check for permissions or revoke granted health permissions.

Health Services Client Version 1.0

Version 1.0.0-alpha03

November 3, 2021

androidx.health:health-services-client:1.0.0-alpha03 is released. Version 1.0.0-alpha03 contains these commits.

New Features

  • The SDK will automatically re-register measure, exercise listener, and passive monitoring callback registration requests in the event that the IPC connection is broken with the Health Services APK.

API Changes

  • minSdkVersion of the SDK library bumped to API level 30 since the Health Services Client is currently only supported on Wear3.

Version 1.0.0-alpha02

September 29, 2021

androidx.health:health-services-client:1.0.0-alpha02 is released. Version 1.0.0-alpha02 contains these commits.

API Changes

  • ExerciseClient now supports preparing an exercise. This allows clients to warm-up the sensors and wait for things like a GPS Fix before starting exercise.
  • Introduces CumulativeDataPoints and StatisticalDataPoints AggregateDataPoint classes to better model aggregate metrics tracked during an active exercise. CumulativeDataPoints hold cumulative values of aggregated interval data types (such as total distance during the exercise) while StatisticalDataPoints model aggregates of sampled data points (such as min, max, and average HeartRateBpm). This replaces the previous AGGREGATE_* DataTypes and can be accessed in the ExerciseUpdate via getLatestAggregateMetrics(). AGGREGATE_* DataTypes are no longer supported.
  • PassiveMonitoring Events have been renamed to PassiveGoals which supports setting of goals and receiving notifications when those goals are met for data types like Daily metrics (i.e. DAILY_STEPS).
  • Improved modeling of Heart Rate and Location accuracy and availability via the introduction of the new HrAccuracy, LocationAccuracy, and LocationAvailability classes.
  • Improved naming of ExerciseConfig and new PassiveMonitoringConfig fields and introduction of ExerciseConfig.shouldEnableGps to request GPS-backed data

Bug Fixes

  • Migrates to proto-backed IPC transport for better backwards compatibility support

Version 1.0.0-alpha01

May 18, 2021

androidx.health:health-services-client:1.0.0-alpha01 is released. Version 1.0.0-alpha01 contains these commits.

Features of initial release

The Health Services library provides a uniform set of APIs for developers to integrate with device-specific sensor implementations. It will work out of the box with Wear OS 3 emulators and upcoming devices, with additional platforms supported in the future. Three top level API surfaces are included in this initial release: The ExerciseClient, PassiveMonitoringClient, and MeasureClient.

ExerciseClient

The ExerciseClient is made for applications tracking active workouts, with up to 82 different ExerciseTypes from walking and running to dancing and water polo. While tracking these exercises, there’s a selection of 50 different DataTypes available depending on the exercise type and hardware available on the device. To get started, just specify the relevant information in your ExerciseConfig, call exerciseClient.startExercise and listen for progress on the update listener.

PassiveMonitoringClient

The PassiveMonitoringClient is a great choice if your application tracks the user’s activity throughout the day. You can register a PendingIntent with a set of DataTypes and be woken up to handle batched changes. Alternatively, you can specify an Event such as reaching a certain number of steps.

MeasureClient

Sometimes the user needs to measure e.g. their heart rate in the moment, not during an exercise and not throughout the day. In those moments the MeasureClient is the perfect choice.You just register your callback with supported DataTypes to receive a stream of data, unregistering your callback when it’s no longer needed.