Get started

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

Refer to the following resources before you begin installation of Health Connect.


  • Health Connect SDK (available on Jetpack). Include this SDK in your application to use the Health Connect API.
  • API reference. See the Jetpack reference for the Health Connect API.
  • API Request Developer Declaration Form. Form to request access to read and/or write data types.
  • Github code sample and codelab (Optional). See the Github code sample repository and the codelab to help you get started.

Follow these quick and simple steps to integrate with Health Connect:

Step 0: Install Health Connect

Install Health Connect by Android from the Google Play Store to your device. It will handle all requests sent by your application using the Health Connect SDK.

Step 1: Add the Health Connect SDK to your application

Add a dependency on the Health Connect SDK in your module’s build.gradle file:

dependencies {
  implementation ""

Find the latest version on release.

Step 2: Get Health Connect client

HealthConnectClient is an entry point to the Health Connect API.

Here’s a step-by-step description of the process of connecting with Health Connect:

  1. To interact with Health Connect within the app, declare the Health Connect package name in your AndroidManifest.xml file:

    <!-- Check whether Health Connect is installed or not -->
        <package android:name="" />
  2. Check if Health Connect is installed. If it is, obtain a HealthConnectClient instance.

    if (HealthConnectClient.isProviderAvailable(context)) {
      // Health Connect is available and installed.
      val healthConnectClient = HealthConnectClient.getOrCreate(context)
    } else {
      // ...
  3. The client app must then request permission from the user. The user can grant or deny access to the client app at any point.

HealthConnectClient automatically manages its connection to the underlying storage layer and handles all IPC and serialization of outgoing requests and incoming responses.

Step 3: Declare permissions

  1. Declare the permissions for the data types that your app will use.

    Every data type your app reads or writes needs to be declared using a permission in your manifest. For the full list of permissions and their corresponding data types, see List of data types.

    Starting SDK alpha10 and above, Health Connect uses the standard Android permission declaration format.

    <uses-permission android:name=""/>
    <uses-permission android:name=""/>
    <uses-permission android:name=""/>
    <uses-permission android:name=""/>

    If you are using sdk version alpha09 or below, create an array resource in res/values/health_permissions.xml.

      <array name="health_permissions">
  2. Add metadata to your manifest to explain your app's use of Health Connect.

    You manifest needs to provide <activity> which displays to the user a privacy policy describing how the user's data is used and handled. You can either add a new <activity>, or modify an existing one.

    This activity needs to:

    1. (For alpha09 and below only) Reference the health_permissions resource mentioned above; and

    2. Declare that it handles the ACTION_SHOW_PERMISSIONS_RATIONALE intent. This intent is sent to the app when the user clicks on the "Read privacy policy" link in the Health Connect permissions dialog.

        <!-- Activity to show rationale of Health Connect permissions -->
          <!-- (a) For alpha09 and below, reference permissions resource -->
              android:resource="@array/health_permissions" />
          <!-- (b) handle intent -->
            <action android:name="" />

Step 4: Request permissions from the user

To display the permission dialog, first build a set of permissions for required data types. Ensure the permissions in the set are first declared, as previously described.

For alpha10 and above:

// build a set of permissions for required data types

For alpha09 and below:

// build a set of permissions for required data types

Next, use getGrantedPermissions() to see if your app already has the required permissions. If not, use the createRequestPermissionResultContract() method to request permission.

// Create the permissions launcher.
val requestPermissionActivityContract = PermissionController.createRequestPermissionResultContract()

val requestPermissions =
 registerForActivityResult(requestPermissionActivityContract) { granted ->
   if (granted.containsAll(PERMISSIONS)) {
     // Permissions successfully granted
   } else {
     // Lack of required permissions

suspend fun checkPermissionsAndRun(healthConnectClient: HealthConnectClient) {
   val granted = healthConnectClient.permissionController.getGrantedPermissions(PERMISSIONS)
   if (granted.containsAll(PERMISSIONS)) {
     // Permissions already granted, proceed with inserting or reading data.
   } else {

If the user declines your permission request twice, your app is permanently locked out, and cannot request permissions again. If this happens to your app during development and testing, reset the permission request count by opening the Health Connect app and selecting allow all then remove all. Alternatively use adb to clear the cache of the Health Connect package.

Users can grant or revoke permissions using the Health Connect app at any time. Don't assume that the set of granted permissions does not change; your app should periodically check for granted permissions, and be able to handle scenarios where permission is unexpectedly lost.

Health data is sensitive, so to maintain user trust, only request permission to access data in context. Do no request data that is not used by your app.