Skip to main content

Google Fit

Google Fit is a platform that helps users live healthier lives by tracking their fitness and health data. As a developer, you can integrate your app with Google Fit to read fitness data and write fitness data to a user's Google Fit account. This guide will explain how to set up Google Fit API and why it's required.

Prerequisites

Before you start integrating with Google Fit, make sure you have the following:

  • A Google account
  • An Android or iOS app that will be using Google Fit API

Setup

This section describes how to generate a unique Google Fit client ID for your application. The client ID is required for using Google Fit with Metric (and in general too).

For a guided process and to enable client ID automatically, go to get a client id.

Manual steps

Step 1: Create a Project in Google Cloud Console

If you already have a project created, you should skip this step. To create a project in Google Cloud Console, follow these steps:

  • Go to the Google Cloud Console.
  • Create a new project by clicking on the + button in the top navigation bar and then selecting "Project".
  • Name your project and click on the "Create" button.

Step 2: Enable Fitness API

To enable Fitness API access, follow these steps:

  • In the Google Cloud Console, select your project from the dropdown in the top navigation bar.
  • Click on the hamburger menu icon in the top left corner and navigate to "APIs & Services" > "Dashboard".
  • Click on the "+ ENABLE APIS AND SERVICES" button.
  • Search for "Fitness API" and select it.
  • Click on the "Enable" button.

Step 3: Create Client ID

To create OAuth 2.0 client id, follow these steps:

  • Click on "Go to credentials".
  • Click on the "+ CREATE CREDENTIALS" button and select "OAuth client ID".
  • Select "Android" or "iOS" as the application type depending on your app platform.
  • Enter the package name (for Android) or bundle ID (for iOS) of your app.
  • Enter a name for your OAuth client ID.
  • Click on the "Create" button. Your new client id and secret will appear. An OAuth 2.0 Client ID is a string of characters, something like: 780816631155-gbvyo1o7r2pn95qc4ei9d61io4uh48hl.apps.googleusercontent.com