The History API enables your app to perform bulk operations on the fitness store: inserting, deleting, and reading fitness data. Use the History API to:
- Import batch data into Google Fit.
- Read fitness data that was inserted or recorded using other apps.
- Delete data that your app previously stored in the fitness history.
- Disable Google Fit for an app.
To insert fitness data with session metadata, you can use the Sessions API.
To read data from the fitness history, first create a
The data request can specify multiple data types to return, effectively combining
multiple data queries into one call. This example only specifies the
data type. The data request can also indicate whether to return
time-series data points or aggregated data points. This example uses aggregated data points
where each point represents the number of steps walked in a day. For this particular use case,
aggregated data points have two advantages:
- Your app and the fitness store exchange smaller amounts of data.
- Your app does not have to aggregate the data manually.
The following example demonstrates how to obtain the points from a dataset:
To insert data into the fitness history, first create a
Google Fit enables your app to delete fitness data that it inserted into the fitness history.
To delete fitness data from the fitness history, use the
Apps can provide specific sessions or delete all data. Fore more information, see the API