Health Connect
Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |
---|---|---|---|---|
September 6, 2023 | - | - | - | 1.1.0-alpha04 |
Requesting access to data types
To help us strengthen user privacy and security, developers integrating with Health Connect must request read and/or write access for data types by completing the following developer declaration form. In the request, include a valid use case(s) for the data types you need based on the app's purpose. For more information, visit Health Connect Policy Requirements FAQ and Health Connect by Android Permissions.
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 { // Use to implement health connects implementation "androidx.health.connect:connect-client:1.1.0-alpha04" }
Kotlin
dependencies { // Use to implement health connects implementation("androidx.health.connect:connect-client:1.1.0-alpha04") }
For more information about dependencies, see Add build dependencies.
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.
Version 1.1
Version 1.1.0-alpha04
September 6, 2023
androidx.health.connect:connect-client:1.1.0-alpha04
is released. Version 1.1.0-alpha04 contains these commits.
API Changes
- Java only: rename the
getHasMore()
field onChangesResponse
tohasMore()
. (I80695) - Align
HealthPermissionsRequestContract#createIntent
check across Android versions. The contract checks that all permissions are health-related permissions. (I143fc)
Bug Fixes
- Fix exception that is thrown when
ExerciseSessionRecord
is created with anExerciseRoute
containing empty list of location. (I45c16) - Update
SleepSessionRecord
documentation and sample code for reading sleep sessions. (Idf0de)
Version 1.1.0-alpha03
July 26, 2023
androidx.health.connect:connect-client:1.1.0-alpha03
is released. Version 1.1.0-alpha03 contains these commits.
New Features
- API for reading and writing Exercise routes:
- Added
ExerciseRouteResult
toExerciseSessionRecord
- Added
ExerciseRouteRequestContract
- Added
API Changes
- Added
ExerciseRouteResult
and its subclasses:Data
,NoData
andConsentRequiredStates
. - Added
ExerciseRoute
as a standalone class, which holds location data for the route. (I22eed) - Added
PERMISSION_WRITE_EXERCISE_ROUTE
. (I92fc4) - Added
ExerciseRouteRequestContract
, addedHealthPermissionsRequestContract
. (Ief0e5)
Bug Fixes
- Fixed construction of Energy in kilojoules (Ie8791)
Version 1.1.0-alpha02
June 21, 2023
androidx.health.connect:connect-client:1.1.0-alpha02
is released. Version 1.1.0-alpha02 contains these commits.
Bug Fixes
- Fixed
HealthDataSdkService
leak (Ia3ba5) - Always redirect to the right
HealthConnect
Client when requesting permissions on Android U.(I6415a)
Version 1.1.0-alpha01
June 7, 2023
androidx.health.connect:connect-client:1.1.0-alpha01
is released. This version is developed in an internal branch.
New Features
- Support for the Android 14 framework version of Health Connect. This SDK is a prerequisite for Android 14. Apps will not be able to integrate with Health Connect on Android 14 without it.
- Added recording method to record metadata.
API Changes
- Session API changes:
- Added various sleep stages into
SleepSessionRecord
and removedSleepStageRecord
. - Added
ExerciseLap
andExerciseSegment
intoExerciseSessionRecord
.
- Added various sleep stages into
- Periodic and daily rate limits (including memory limits), for read, changelog, insertion and deletion operations.
- Added validation for all
NutritionRecord
fields. - Added validation for
HeartRateVariabilityRmssdRecord
. - Removed two deprecated APIs:
HealthConnectClient#isProviderAvailable
andHealthConnectClient#isApiSupported
.
Bug Fixes
- Fixed units equality for all unit types, equality no longer depends on type used for unit initialization. E.g. Mass.grams(1000) is now equal to Mass.kilograms(1).
Version 1.0
Version 1.0.0-alpha11
February 22, 2023
androidx.health.connect:connect-client:1.0.0-alpha11
is released. Version 1.0.0-alpha11 contains these commits.
API Changes
- Adding an intent to use for opening Health Connect. (Ic8055)
- Removing some exercise types. Use
EXERCISE_TYPE_STRENGTH_TRAINING
,EXERCISE_TYPE_HIGH_INTENSITY_INTERVAL_TRAINING
orEXERCISE_TYPE_CALISTHENICS
in place of the removed types. (I7291c) - Adding new API
sdkStatus()
that combines the two now deprecated APIsisSdkSupported()
andisProviderAvailable()
. (Iac89d) - Changing APIs that accept
providerPackageName
to accept a single string rather than a list. (I67e0f)
Version 1.0.0-alpha10
January 25, 2023
androidx.health.connect:connect-client:1.0.0-alpha10
is released. Version 1.0.0-alpha10 contains these commits.
API Changes
ExerciseEventRecord
,ExerciseLapRecord
,ExerciseRepititionRecord
andSwimmingStrokesRecord
are no longer supported asRecordTypes
. They can no longer be written or read fromHealthConnect
. Remove any reference to these data types from theHealthConnect
integration. (If7ca2)- Changes in permissions APIs to accept permissions in a new string based format. This change also requires changing permission declaration to the standard android permissions format. (Ib0a2f)
Version 1.0.0-alpha09
January 11, 2023
androidx.health.connect:connect-client:1.0.0-alpha09
is released. Version 1.0.0-alpha09 contains these commits.
New Features
- Added 2 new female health datatypes for Health Connect:
IntermenstrualBleedingRecord
, andMenstruationPeriodRecord
.MenstruationFlow.ENUMs
are Light, Medium, Heavy, and Unknown.
API Changes
Version 1.0.0-alpha08
December 7, 2022
androidx.health.connect:connect-client:1.0.0-alpha08
is released. Version 1.0.0-alpha08 contains these commits.
API Changes
- Adds
BodyWaterMass
,HeartRateVariabilityRmssdRecord
as new supported Record Types. (Ifd58f) - Removes
HipCircumferenceRecord
,WaistCircumferenceRecord
as supportedRecordTypes
. (I62fb9) - Changed
MenstruationFlowRecord.flow
fromstringdef
tointdefs
. (I0369f) - Changed enum-like Record fields with
Strings
toIntegers
for better performance. (I3b295) - Changed
ExerciseSession
,ExerciseRepetitions
,SleepStage
enum-like fields from string to integer types. (Id32a9) - Renamed
ExerciseSessionRecord.ACTIVE_TIME_TOTAL->EXERCISE_DURATION_TOTAL
. (I5d7bd) - Adds "Unusual" to
CervicalMucus
enums. Rename "Clear" to "Eggwhite" for more specificity. ChangedCervicalMucus#appearance
and #sensation fromStringDefs
to IntDefs. (I3ac51) StringDef
ofDeviceTypes
enum is now moved intoIntDefs
under Device. (I3abf3)- Adds
HealthConnectClient.isApiSupported()
, which returns false on SDK versions with no compatible implementations. RenamedHealthConnectClient.isAvailable->isProviderAvailable
. (I3674e)
Bug Fixes
- Disallow
HeartRate beatsPerMinute
values less than 1 (I6052f) - Adding
@JvmDefaultWithCompatibility
annotation (I8f206)
Version 1.0.0-alpha07
October 24, 2022
androidx.health.connect:connect-client:1.0.0-alpha07
is released. Version 1.0.0-alpha07 contains these commits.
API Changes
- Record arguments without default values are placed before arguments with default values. For consistency,
Instant
andZoneOffset
arguments are always placed at the very beginning. (Id618c) - Rename
HealthConnectClient.getOrCreate#packageNames
toproviderPackageNames
. (Id81e4)
Bug Fixes
- Adds Record field value validations. Extremely wrong values will throw
IllegalArgumentExceptions
when provided value is out of reasonable bounds. (Ie171d) - Validates record start time before end time where relevant. (I02460)
Version 1.0.0-alpha06
October 5, 2022
androidx.health.connect:connect-client:1.0.0-alpha06
is released. Version 1.0.0-alpha06 contains these commits.
Bug Fixes
- Improves service connection lifecycle. (If2bd5)
- Fix an NPE crash bug when exception raised in service connection. (I13546)
Version 1.0.0-alpha05
September 21, 2022
androidx.health.connect:connect-client:1.0.0-alpha05
is released. Version 1.0.0-alpha05 contains these commits.
API Changes
- Renamed
Metadata.uid
->Metadata.id
and used the terminologyrecordId
consistently throughout related CRUD APIs. (I3d1d2) - Made
PermissionController.createRequestPermissionActivityContract
a static method instead of an instance method. Renamed toPermissionController.createRequestPermissionResultContract
. (Icd2fe) - Added
BloodGlucose
unit type forBloodGlucoseRecord
(I97678) - Rename
MenstruationRecord
->MenstruationFlowRecord
. (I3b88e)
Bug Fixes
- Fix unintended behavior not propagating foreground stats from client process. (Ifb44c)
Version 1.0.0-alpha04
August 24, 2022
androidx.health.connect:connect-client:1.0.0-alpha04
is released. Version 1.0.0-alpha04 contains these commits.
Migration to `androidx.health.connect
As of 1.0.0-alpha04, androidx.health:health-connect-client
was migrated to
androidx.health.connect:connect-client
. For previous versions of Health
Connect, please visit the
androidx.health
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
.
New Features
- Included optional debug logs builtin for API calls (link)
API Changes
- Renamed Metadata
clientId
toclientRecordId
,clientVersion
toclientRecordVersion
. (link) - Made Metadata uid more friendly to readers, no longer nullable. (link)
- Added pounds to Mass unit (link)
- Renamed
DeletionChange.deleteUid
to uid (link) - Rename Permission -> HealthPermission. This avoids ambiguity with Android Framework permissions. (link)
Bug Fixes
- Fixed regression issues with incorrect calories unit with Energy (link)
- Fixed regression issue with aggregation for few record types (link)