Check for feature availability
Stay organized with collections
Save and categorize content based on your preferences.
When new features are added to Health Connect, users may not always update their
version of Health Connect. The Feature Availability API is a way to check if a
feature in Health Connect is available on your user's device and decide what
action to take.
Get started
The Feature Availability API shares the same dependency as the Health Connect
SDK. To get started, verify that at least version 1.1.0-alpha08
is in your
build.gradle
file:
dependencies {
implementation("androidx.health.connect:connect-client:1.1.0-alpha08")
}
The main function to check for feature availability is getFeatureStatus()
.
This returns integer constants FEATURE_STATUS_AVAILABLE
or
FEATURE_STATUS_UNAVAILABLE
:
if (healthConnectClient
.features
.getFeatureStatus(
HealthConnectFeatures.FEATURE_READ_HEALTH_DATA_IN_BACKGROUND
) == HealthConnectFeatures.FEATURE_STATUS_AVAILABLE) {
// Feature is available
...
} else {
// Feature is not available
...
}
For a list of all available feature flags, see the HealthConnectFeatures
reference page.
Handle lack of feature availability
If a feature isn't available on a user's device, an update may enable it. You
may consider directing the user to update Health Connect if they don't have
the latest supported version on their device. However, users using the APK
(on Android 13 and lower) can't use the system module features that are only
available on devices running Android 14 or higher.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-22 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-22 UTC."],[],[],null,["# Check for feature availability\n\nWhen new features are added to Health Connect, users may not always update their\nversion of Health Connect. The Feature Availability API is a way to check if a\nfeature in Health Connect is available on your user's device and decide what\naction to take.\n\nGet started\n-----------\n\nThe Feature Availability API shares the same dependency as the Health Connect\nSDK. To get started, verify that at least version `1.1.0-alpha08` is in your\n`build.gradle` file: \n\n dependencies {\n implementation(\"androidx.health.connect:connect-client:1.1.0-alpha08\")\n }\n\nPerform the check\n-----------------\n\nThe main function to check for feature availability is `getFeatureStatus()`.\nThis returns integer constants `FEATURE_STATUS_AVAILABLE` or\n`FEATURE_STATUS_UNAVAILABLE`: \n\n if (healthConnectClient\n .features\n .getFeatureStatus(\n HealthConnectFeatures.FEATURE_READ_HEALTH_DATA_IN_BACKGROUND\n ) == HealthConnectFeatures.FEATURE_STATUS_AVAILABLE) {\n\n // Feature is available\n ...\n } else {\n // Feature is not available\n ...\n }\n\nFor a list of all available feature flags, see the [`HealthConnectFeatures`](/reference/androidx/health/connect/client/HealthConnectFeatures)\nreference page.\n\nHandle lack of feature availability\n-----------------------------------\n\nIf a feature isn't available on a user's device, an update may enable it. You\nmay consider directing the user to update Health Connect if they don't have\nthe latest supported version on their device. However, users using the APK\n(on Android 13 and lower) can't use the system module features that are only\navailable on devices running Android 14 or higher."]]