Time for action – working with live fitness data using the Sensors API
The Sensors API is provided to work with a live stream of fitness sensor data. It can provide data from sensors on local or connected devices. The Sensors API is a part of Google play services and can be connected using the GoogleApiClient
class. In SensorActivity
, we first add the required scopes and Sensors API and then connect to Google play services using an object of the GoogleApiClient
class. The steps for connecting to Google play services via the GoogleApiClient
class are explained in the first section of the driving event detection application of the bonus chapter, Sensor Fusion and Sensors-Based APIs – The Driving Events Detection App, during the discussion on the activity recognition API. The only difference in steps is that, instead of adding activity recognition API; we have to add Sensors API. Now let's look at the individual tasks performed by SensorActivity
:
The first task performed by
SensorActivity
is...