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:
- Retrieve the session.
- Read the
To obtain the package name of the Android application or the name of the REST application that inserted a dataset:
- Retrieve the dataset.
- Retrieve the data source by reading the
- Read the
application property contains these fields:
- The name of the application.
- The package name of the Android application.
- (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:
- You add your application details to the
dataSources.applicationproperty when creating data sources.
- You specify the correct
datasets.dataSourceIdfor your data source when adding points to datasets.
Applications accessing data you inserted can use this information to attribute that data to your application.