Data Attribution

Every data point in Google Fit has an associated data source. Data sources contain information to identify the app or the device that collects or transforms the data.

The REST API lets you determine which app inserted fitness data. For example, an app that analyzes a variety of data from the user's fitness history may want to present users with the list of fitness sessions included in the analysis, along with information about which app inserted each session.

The REST API also lets you associate data that you insert in the fitness store with your application.

Determine which application inserted data

To obtain the package name of the Android application that inserted a session or the name of the REST application that inserted a session:

  1. Retrieve the session.
  2. Read the session.application.packageName or session.application.name property.

To obtain the package name of the Android application or the name of the REST application that inserted a dataset:

  1. Retrieve the dataset.
  2. Retrieve the data source by reading the dataset.dataSourceId property.
  3. Read the dataSources.application.packageName or dataSources.application.name property.

The application property contains these fields:

name
The name of the application.
packageName
The package name of the Android application.
detailsUrl
(Optional) A URI to link to the application.

When you list all available sessions for a time interval in your application, you can use this information to show your users which app inserted each session.

Provide information about your application

To attribute data you insert into the fitness store to your application, ensure that:

Applications accessing data you inserted can use this information to attribute that data to your application.