Let’s try Google Fit || Amazing Collection of APIs for Health Gadgets
Google Fit has an open platform that lets users control their fitness data, developers build smarter apps, and manufacturers focus on creating amazing devices.
What is Google Fit?
Google Fit is an open ecosystem that allows developers to upload fitness data to a central repository where users can access their data from different devices and apps in one location:
- Fitness apps can store data from any wearable or sensor.
- Fitness apps can access data created by an app.
- User’s fitness data is persisted when they upgrade their fitness devices.
Components of Google Fit
Google Fit consists of the following components:
- The fitness store
- A central repository that stores data from a variety of devices and apps. The fitness store is a cloud service that is transparent to clients.
- The sensor framework
- A set of high-level representations that make it easy to work with the fitness store. You use these representations with the Google Fit APIs.
- Permissions and user controls
- A set of authorization scopes to request user permission to work with fitness data. Google Fit requires user consent to access fitness data.
Google Fit APIs
Android and REST APIs to access the fitness store. You can create apps that support Google Fit on multiple platforms and devices, such as Android, iOS, and Web apps.
The fitness store
The fitness store is a cloud service that persists fitness data using Google’s infrastructure. Apps on different platforms and devices can store data and access data created by other apps. Google Fit provides a set of APIs that make it easy to insert data and query the fitness store.
The sensor framework
The sensor framework defines high-level representations for sensors, fitness data types, data points, and sessions. These representations make it easy to work with the fitness store on any platform.
- Data Sources
- Data sources represent sensors and consist of a name, the type of data collected, and other sensor details. A data source may represent a hardware sensor or a software sensor. You can define software sensors in your apps.
- Data Types
- Data types represent different kinds of fitness data, like step count or heart rate. Data types establish a schema through which different apps can understand each other’s data. A data type consists of a name and an ordered list of fields, where each field represents a dimension. For example, a data type for location contains three fields (latitude, longitude, and accuracy), whereas a data type for weight contains only one field.
- Data Points
- Data points consist of a timestamped array of values for a data type, read from a data source. You use data points to record and insert fitness data in the fitness store, and to read raw data from a data source. Points that contain a start time represent a time range instead of an instantaneous reading.
- Datasets represent a set of data points of the same type from a particular data source covering some time interval. You use datasets to insert data into the fitness store. Queries to read data from the fitness store also return datasets.
- Sessions represent a time interval during which users perform a fitness activity, such as a run, a bike ride, and so on. Sessions help organize data and perform detailed or aggregate queries on the fitness store for a fitness activity.
Google Fit APIs
Google Fit provides the following APIs:
- Android APIs for Android apps.
- REST API for apps on any platform.
Google Fit on Android consists of these APIs:
- The Sensors API provides access to raw sensor data streams from sensors available on the Android device and from sensors available in companion devices, such as wearables.
- The Recording API provides automated storage of fitness data using subscriptions. Google Fit stores fitness data of the specified types in the background and persists app subscriptions.
- The History API provides access to the fitness history and lets apps perform bulk operations, like inserting, deleting, and reading fitness data. Apps can also import batch data into Google Fit.
- The Sessions API provides functionality to store fitness data with session metadata. Sessions represent a time interval during which users perform a fitness activity.
- The Bluetooth Low Energy API provides access to Bluetooth Low Energy sensors in Google Fit. This API enables your app to look for available BLE devices and to store data from them in the fitness store.
- The Config API provides custom data types and additional settings for Google Fit. For more information, see Custom Data Types and Disconnect from Google Fit.
Google Fit includes support for sensors on the mobile device and Bluetooth Low Energy sensors paired with the device. Google Fit lets developers implement support for other sensors and expose them as software sensors in Android apps. Sensors supported by Google Fit are available to Android apps as data source objects.
The Google Fit REST API enables you to store and access user data in the fitness store from apps on any platform.
The REST API provides resources and methods to:
- Create, obtain, list, and modify data sources. A data source represents a unique source of sensor data. All fitness data in the fitness store is associated with a particular data source.
- Create, obtain, aggregate, and delete datasets. A dataset represents a set of data points from a particular data source.
- List data points and add them to a dataset. A data point represents a sample from a particular data source.
- Create, list, and delete sessions. A session represents a time interval with associated metadata.
Source : https://developers.google.com/fit/overview