Chapter 9 Google Fit API

9.1 Google Fit API

The Google Fit API (also referred to simply as the Fit API) resides in the namespace and is available as part of Google Play Services. Any Google Fit App has a dependency on the Google Play Services App being installed on the device that it is running on.

9.2 Google fit main package (

The Google Fit API documentation is available at and is a useful reference when reading this chapter.

In all, the main package fitness and its sub-packages contain about eight high-level interfaces and 30 high-level classes. The main package fitness contains four sub-packages: data, service, request, and result. The fitness package itself contains the interfaces SensorsApi, BleApi (Bluetooth Low Energy API), SensorsApi, RecordingApi, HistoryApi, and SessionsApi, as well as the classes Fitness, FitnessActivities, and FitnessStatusCodes.

Figure 9-1 shows the classes and interfaces within the main fitness package, as well as the sub-packages data, request, result, and service.


Figure 9-1 Google Fit’s fitness package, high-level overview.

9.2.1 Fitness class

The Fitness class is the entry point into the Google Fit API. In order for a Fit App to connect to the Fit API, a Google user account is required on the device. The Fit App needs ...

Get Wearable Android: Android Wear and Google FIT App Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.