Health
| Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |
|---|---|---|---|---|
| May 7, 2025 | 1.0.0 | - | - | 1.1.0-alpha05 |
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.1.0-alpha05" }
Kotlin
dependencies { implementation("androidx.health:health-services-client:1.1.0-alpha05") }
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.
See the Issue Tracker documentation for more information.
Health Connect Client Version 1.0
Version 1.0.0-alpha04
August 24, 2022
As of 1.0.0-alpha04, androidx.health:health-connect-client was migrated to
androidx.health.connect:connect-client. For future, releases please use
androidx.health.connect:connect-client and the associated release notes on our
Health Connect page.
To migrate, simply change your dependency import from
androidx.health:health-connect-client:1.0.0-alpha03 to
androidx.health.connect:connect-client:1.0.0-alpha04.
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
NutritionRecordnutrients.
API Changes
- Fix
List<DataOrigin>to beSet<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.SampleHeartRate->HeartRateRecord.SampleStepsCadence->StepsCadenceRecord.Sample
- Deprecate
HealthDataRequestPermissionclass, in favor ofPermissionController.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
PowerRecordclass. (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
- Renamed
- Moved package metadata nested under records. (Ie0835)
- Used Length unit in all remaining records (Ib10dd):
ActivityLapRecordElevationGainedRecordHeightRecordHipCircumferenceRecordWaistCircumferenceRecord
- Added Length unit type (Idae39)
- Update
CervicalMucusdescription terminology (I25a2b):CervicalMucus.Amount->CervicalMucusRecord.TextureCervicalMucus.Appearance->CervicalMucusRecord.Sensation
- Added 'Record' suffix to all record class names (I1ffc2)
Bug Fixes
- Fix proguard issues when lib built with release flavor and
minifyEnabledtrue. (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
hasMetricandgetMetricinAggregationResult, added contains and get operators (I7cc7c) - Adds
OvulationTest.Result.HIGHandOvulationTest.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.1
Version 1.1.0-alpha05
December 11, 2024
androidx.health:health-services-client:1.1.0-alpha05, androidx.health:health-services-client-external-protobuf:1.1.0-alpha05, and androidx.health:health-services-client-proto:1.1.0-alpha05 are released. Version 1.1.0-alpha05 contains these commits.
New Features
- Now includes proguard rules to avoid necessary classes from being stripped out. (65d0c3f)
Bug Fixes
- This library now uses JSpecify nullness annotations, which are type-use. Kotlin developers should use the following compiler argument to enforce correct usage:
-Xjspecify-annotations=strict(this is the default starting with version 2.1.0 of the Kotlin compiler). (Iaf73a, b/326456246)
Version 1.1.0-alpha04
October 16, 2024
androidx.health:health-services-client:1.1.0-alpha04, androidx.health:health-services-client-external-protobuf:1.1.0-alpha04, and androidx.health:health-services-client-proto:1.1.0-alpha04 are released. Version 1.1.0-alpha04 contains these commits.
Security Fixes
- As of this change, androidx compiles against protobuf 4.28.2 in order to address CVE-2024-7254. Upgrade your dependency on
androidx.health:health-services-clientto the latest 1.1.0-alpha04 to address the vulnerability risk.
Version 1.1.0-alpha02
December 13, 2023
androidx.health:health-services-client:1.1.0-alpha02 is released. Version 1.1.0-alpha02 contains these commits.
API Changes
- Use a single source of truth for supported
ExerciseEvents. (I03308)
Bug Fixes
- Minor bug fixes and documentation improvements.
Version 1.1.0-alpha01
August 9, 2023
androidx.health:health-services-client:1.1.0-alpha01 is released. Version 1.1.0-alpha01 contains these commits.
New Features
ExerciseEventAPIs have been added alongside the first concrete event:GolfShotEvent. TheExerciseEventprimitives enable developers to query support for and request to be notified when the watch detects something has occurred.GolfShotEventas an example enables developers to be notified when the user takes a golf shot in addition to receiving the swing type recognized.
API Changes
- Enable WHS SDK clients to use
GolfShotEventfunctionalities. (I76b03)
Bug Fixes
- Instead of aggressively throwing exceptions on seeing unknown exercise event capabilities, filter it out from the list. (I06afc)
Health Services Client Version 1.0
Version 1.0.0
May 7, 2025
androidx.health:health-services-client:1.0.0 is released. Version 1.0.0 contains these commits.
Major features of 1.0.0
- This is the promotion of 1.0.0-rc02 to be the stable release of Health Services Client. There are no changes from 1.0.0-rc02.
Version 1.1.0-alpha03
May 14, 2024
androidx.health:health-services-client:1.1.0-alpha03 is released. Version 1.1.0-alpha03 contains these commits.
New Features
- Introduced
DebouncedGoalAPIs that allows tracking a goal for sample data type or stats sample data type during exercise with debouncing features(initialDelayanddurationAtThreshold). (I09be9) - Added the following advanced running metrics sample and statistical
DataTypes. (I0b8b5):Ground Contact TimeVertical OscillationVertical RatioStride Length
API Changes
- Added
ELEVATION_GAIN_DAILYDataType. (I059d1) - Added
SWIM_LAP_COUNT_TOTALDataTypeas the aggregatedDataTypeforSWIM_LAP_COUNT. (I0beeb)
Bug Fixes
- Fixed various issues to improve IPC reliability.
Version 1.0.0-rc02
April 3, 2024
androidx.health:health-services-client:1.0.0-rc02 is released. Version 1.0.0-rc02 contains these commits. This is a bug fix only release and does not contain API changes.
Bug Fixes
- Fixed various issues to improve IPC reliability
- Fixed an issue where calling
startExerciseat the same time asprepareExercisecould lead to aConcurrentModificationException(4e37773) - Improved documentation
Version 1.0.0-rc01
July 26, 2023
androidx.health:health-services-client:1.0.0-rc01 is released. Version 1.0.0-rc01 contains these commits.
New Features
- Health Services has moved to 1.0.0-rc01 after stabilizing in beta.
API Changes
- Merged public and experimental API files for h- thru m-paths. (Ic4630, b/278769092)
- N/A, API file changes are just reordering methods. (I5fa95)
Version 1.0.0-beta03
April 5, 2023
androidx.health:health-services-client:1.0.0-beta03 is released. Version 1.0.0-beta03 contains these commits.
New Features
BatchingMode can now be configured to deliver batched exercise data at the configured interval instead of the default during an active exercise, either at exercise start via ExerciseConfig or during with an override method. Support for this will be enabled by an upcoming Health Services release in the Google Play Store and can be checked via exercise capabilities. Note: batching modes take effect while the device is in a non-interactive power state, and will cause increased power consumption.
API Changes
- Throwing
HealthServicesExceptionwhen suspend functionoverrideBatchingModesForActiveExercisefails (Ifd387) - Introduced suspend functions for async
overrideBatchingModesForActiveExerciseAPI making them more kotlin friendly (I7dd15) BatchingModeoverrides optional inExerciseConfig(Id22e9)
Bug Fixes
DataTypeandExerciseUpdatesmall fixes (5e185f)
Version 1.0.0-beta02
January 11, 2023
androidx.health:health-services-client:1.0.0-beta02 is released. Version 1.0.0-beta02 contains these commits.
New Features
- Added
suspendextension functions for the existing asynchronousListenableFutureAPIs inExerciseClient,PassiveMonitoringClientandMeasureClientfor better Kotlin support. (Iadea4) - Added
ExerciseTypeConfigAPI which enables updates during an ongoing exercise. AddedGolfExerciseTypeConfigto support updatingExerciseTypeConfigduring golf exercises. (I4c539)
API Changes
- Throw
HealthServicesExceptionon suspend functions (I5e509) - Add another constructor for backward compatibility (Iddeda)
- Throw
RuntimeExceptionon suspend functions (I53bca) - Remove default implementation of throwing Exception (Id947f)
- Adding
@JvmDefaultWithCompatibilityannotation (I8f206)
Bug Fixes
- Add to kdoc for clarity (Ide285)
- Allow passive monitoring tracking for goals only if the same data types are also tracked (Ibed8d)
Version 1.0.0-beta01
October 24, 2022
androidx.health:health-services-client:1.0.0-beta01 is released. Version 1.0.0-beta01 contains these commits.
New Features
Added the ability to listen for health events through
PassiveMonitoringClientwith the first event being:HealthEvent.FALL_DETECTED.New ExerciseTypes:
ALPINE_SKIINGBACKPACKINGCROSS_COUNTRY_SKIINGHORSE_RIDINGINLINE_SKATINGMOUNTAIN_BIKINGORIENTEERINGROLLER_SKATINGYACHTING
New DataTypes:
ELEVATION_LOSSGOLF_SHOT_COUNT
API Changes
- Updated how data is modeled: the data model and how
DataTypes,DataPoints, and their underlying values are represented have been overhauled. The top level impact is that APIs are now much more explicit and type safe. - Location
DataPoints are no longer represented as aDoubleArray, but instead as a strongly-typedLocationDataobject. - Moved to a new set of passive listener APIs:
- The broadcast was replaced by the
PassiveListenerService. - The existing listeners were replaced with a single listener:
PassiveListenerCallback.
- The broadcast was replaced by the
- Added
<queries>tag to Health Services manifest so that applications no longer need to specify this in their own manifest (provided manifest merger is turned on in their build system.) - Moved away from many
ExerciseStates to represent the exercise is ending / ended and added new exercise statesENDINGandENDED. These are now combined withExerciseEndReasonto represent the full gamut of previous states. - Renamed
PassiveListenerConfigsetPassiveGoalstosetDailyGoalsto better reflect we only support daily passive goals. PassiveGoals now alwaysREPEATED, passiveTriggerFrequencyremoved.- Annotated all
LongandDoubleparameters with@FloatRange. - Added
swimmingPoolLengthMetersproperty toExerciseConfigwhich may be optionally specified to improve distance calculations for pool swims. - Deprecated
ExerciseUpdate.activeDuration. UseExerciseUpdate.activeDurationCheckpointinstead. - Renamed the API
flushExerciseAsync()toflushAsync()inExerciseClient. Measure.registerCallbackrenamed toMeasure.registerMeasureCallback.- General naming changes:
- Distance properties now have
meterssuffix. - Callback method names are now past tense.
- Most abbreviations have been removed (
HrAccuracyis nowHeartRateAccuracy.) - Properties following the pattern
enableFooare now namedisFooEnabled.
- Distance properties now have
- Migrated away from Enums.
- Times represented by
Doubleare now represented byDuration. - Functions returning a
ListenableFuture<Void?>now return aListenableFuture<Void>. - Functions that accept a callback now always have the callback appear as the last parameter.
- Classes with builders now always also have public constructors.
- Registration functions no longer return a
ListenableFutureand instead pass registration status to the provided callback. - KDocs have now been improved.
- Public classes no longer extend
ProtoParcelable.
Bug Fixes
- General improvements to IPC reliability (I3b1e2)
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
ExerciseClientnow 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 viagetLatestAggregateMetrics().AGGREGATE_*DataTypes are no longer supported. PassiveMonitoringEvents have been renamed toPassiveGoalswhich 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
ExerciseConfigand newPassiveMonitoringConfigfields and introduction ofExerciseConfig.shouldEnableGpsto 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.