Time for action – recording fitness data in background using Recording API
The Recording API allows your app to request automated storage of sensor data in a battery-efficient manner by creating subscriptions. Once you add a subscription for a data type, then it's Google Play services' responsibility to start recording the data for the requested data type in the background. This recorded data is stored in the Google fitness store and can be queried by History API. The Recording API only decides which data type to record; everything else is managed by the Google fitness platform. The Recording API is part of Google play services. The steps for connecting to Google play services via the GoogleApiClient
class are exactly the same as for the Sensors API, discussed in the previous section. In our example, inside SubscriptionActivity
we will perform four important tasks with subscriptions. First, we will get authorization to read history data from the fitness store using the History API. Second...