Migration Guide

Google has many health products and services in its portfolio, including Health Connect. The Google Fit Android API has been deprecated and will be supported until the end of 2024, when it will be turned down. The following guidelines show you which API or platform to migrate to from each Google Fit Android API.

Sensor API

The Sensor API lets you read raw sensor data in your app in real time. The Sensor API does the following:

  • Lists data sources that are available on the device and on companion devices.
  • Registers listeners to receive raw sensor data.
  • Unregisters listeners so that they no longer receive raw sensor data.

Migrate to the following APIs or platforms from the Sensor API:

Phone Wear

Use SensorManager, FusedLocationProvider

Use Health Services

  • PassiveMonitoringClient
  • MeasureClient
  • ExerciseClient

    Or use SensorManager, FusedLocationProvider

Session API

Sessions represent a time interval during which users perform a fitness activity.

The Session API lets your app create sessions in the fitness store.

Migrate to the following APIs or platforms from the Session API:

Phone Wear

Start/stop: Not applicable. The application should track the state of ongoing sessions internally.

Read/write: Use Health Connect.

Start/stop: Use Health Services (ExerciseClient)

Read/write: Use Health Connect via mobile app.

For specific workflows, we advise the following:

  • Inserting a session: Developers should use Health Connect and either insert an ActivitySession Record or a SleepSession Record accordingly.
  • Recording API

    The Recording API lets your app request automated storage of sensor data in a battery-efficient manner by creating subscriptions. A subscription is associated with an Android app and consists of a fitness data type or a specific data source.

    Migrate to the following APIs or platforms from the Recording API:

    Phone Wear

    Follow these steps to migrate from the Recording API:

    1. Implement data capture using SensorManager.
    2. Write captured data to Health Connect.
    3. Combine steps a and b where necessary in a foreground service, for example, when you need to continue recording data without interacting with the app itself.

    Use Health Services

    • PassiveMonitoringClient
    • ExerciseClient

      See the Health Services documentation for more on the differences between the PassiveMonitoringClient and ExerciseClient.

    History API

    The History API lets your app perform bulk operations on the fitness store including reading, inserting, updating, and deleting historical health and wellness data.

    Migrate to the following APIs or platforms from the History API:

    Phone Wear

    Use Health Connect

    Use Health Connect from the mobile app and not the wearable.

    Goals API

    Goals are targets in the Google Fit app that users can set for themselves. They help motivate users to stay active every day. From within their profile, users can adjust how many steps and heart points they want to aim for each day. The Fit platform records their goals and tracks their daily activity against these using the Goals API.

    Phone Wear
    No replacement API available. No replacement API available.

    BLE API

    Your app can find available Bluetooth Low Energy (BLE) devices and insert sensor data into the Google Fit platform using the BLE API.

    Migrate to the following APIs or platforms from the BLE API:

    Phone Wear
    Use Android Bluetooth APIs directly. Use Android Bluetooth APIs directly.

    Migrating from the Fit Android API to Health Connect API

    There are 3 key steps you need to go through to migrate to the Health Connect API.

    Step 1: Integrate

    The first step to integrating is to add Health Connect to your app. This will include the following:

    • Integrate with Health Connect by following the steps outlined here.
    • Declare data types and access mode required in the app manifest.
    • Get permission from the user to access Health Connect.
    • Read/write data according to your specific use cases or workflows.

    Step 2: Migrate

    We recommend keeping both your Google Fit Android API and Health Connect API integrations active while users migrate from one platform to the other. While we’ve deprecated the Fit Android API, we’re aiming to turn down the API no sooner than the end of 2024. This is to give users enough time to switch to Health Connect and continue their service.

    Step 3: Clean up

    Follow these steps to remove the Fit SDK:

    1. Remove code associated with the Fit Android API.
    2. Remove dependencies.

    The timing of your deprecation of the Fit Android API should depend on your own analytics and assessments. You can maintain integration with the Fit Android API until the end of 2024.