The Google Fit APIs, including the Google Fit REST API, will no longer be available after June 30, 2025. As of May 1, 2024, developers cannot sign up to use these APIs.
Stay organized with collections
Save and categorize content based on your preferences.
This guide explains how to start development with Google Fit on Android.
Setup
Before you start to build your app, complete the steps in the following
sections.
Get a Google Account
To use the Google Fit APIs, you need a Google Account. You can create a new account or
use an existing account. You might want to create a separate account to test
your app from a user's perspective.
Get Google Play services
Get the latest client library for Google Play services on your development
host:
This makes sure that Gradle automatically downloads the fitness SDK when it
builds your app.
Build and test your app
After you finish the setup steps, you can start to build your app. To get
started, learn about the types of data your app can store and
read. Learn more about working with
data in Google Fit.
The data types that your app has permission to access correspond to
authorization scopes. To ask
for these permissions, you need to add
which data types your app needs access to in a FitnessOptions
instance. When your app asks to use any of the Google Fit data
types, the Android SDK automatically checks which scopes they belong to and asks
the user for authorization to those scopes.
Create an API client
Create an API client and add the data types that your app needs to access to
write or read data. The following endpoints are available:
SensorsClient: Access different sources of health and wellness data from hardware sensors in the local device and in companion devices.
RecordingClient: For low-power, always-on background collection of sensor data.
HistoryClient: Insert, delete, and read historical data in
Google Fit.
The following shows the resulting authorization flow that users experience
when they're asked for permissions:
Android permissions: Users see what Android permissions your app
has requested before downloading it. After your app is downloaded, it
requests any runtime permissions that it needs, and users grant or deny
these permissions.
Check and connect: Your app checks whether permissions were
granted before it requests access to other data types.
OAuth scopes request: Google prompts the user to grant your app
the OAuth scopes needed for the data types that it wants to access.
Access applied: After the user grants permissions, your app can
access the data types that belong to the scopes that the user has granted
permission for.
[[["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 2024-10-31 UTC."],[[["This guide provides instructions for Android developers to integrate Google Fit into their applications for accessing and managing fitness data."],["Before starting development, ensure you have a Google account, the latest Google Play services, an OAuth 2.0 client ID, and a configured Android Studio project."],["Developers need to add the Google Play services client library as a dependency in their project's `build.gradle` file to utilize the Fitness API."],["The guide covers various aspects such as data types, API clients, requesting permissions, and the user authorization flow involved in accessing fitness data through Google Fit."],["After development and testing, app developers must apply for verification to obtain the necessary permissions for accessing sensitive and restricted fitness data scopes."]]],[]]