google fit
TRANSCRIPT
Contents• Platform Basics• Google Fit on Android• Storing and Accessing Fitness Data• Using Sensors• Demo• References
Platform Basics
Overview
Architecture
Terminologies
Representation Meanings
Data sources Data sources represent sensors and consist of a name, the type of data collected, and other sensor details.
Data Types Data types represent different kinds of fitness data, like step count or heart rate.
Data Points Data points consist of a time stamped array of values for a data type, read from a data source.
Data Sets Datasets represent a set of data points of the same type from a particular data source covering some time interval.
Sessions Sessions represent a time interval during which users perform a fitness activity, such as a run, a bike ride, and so on.
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.
Permissions and ScopesYour app must request a connection to the fitness service with one or more scopes of access. Each scope provides access to a set of fitness data types.
Google fit on Android
Overview
API Classification
Sensors API
Recording API History API
Sessions API
Bluetooth Low energy
API
Which APIs to use?Use APIs based on what you want to accomplish• To record fitness data, use the Recording API to create
a subscription for each data type you want to record.
• To read fitness data, use the History API to submit a read request for each data type.
• To insert data into the fitness history, use the History API to submit an insert request for each data type.
• To create sessions, use the Sessions API to insert or record fitness data with session metadata.
Getting started
Get the Developer Preview
Create a project on Google developer
console
Connect to the Fitness Service (Authentication)
https://developers.google.com/fit/android/get-started
Storing and accessing fitness data
Recording Fitness Data
Working with Fitness HistoryHistory API enables your app to perform bulk operations on the fitness store: inserting, deleting, and reading fitness data.
Use the History API to:• 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.
Read Fitness data
Working with SessionsTo create sessions for ongoing fitness activities:• Subscribe to fitness data with the RecordingApi.subscribe
method.
• Start a session with the SessionsApi.startSession method when the user initiates the fitness activity.
• Stop the session with the SessionsApi.stopSession method when the user ends the fitness activity.
• Unsubscribe from fitness data you are no longer interested in with the RecordingApi.unsubscribe method.
Using sensors
Using Sensors APIThe Sensors API lets you to read raw sensor data in your app in real time.
Use this API to:
• List data sources available on the device and on companion devices.
• Register listeners to receive raw sensor data.
• Unregister listeners to stop receiving raw sensor data.
Register for real time sensor data
Demo Time
References• Google Fit Official Documentationhttps://developers.google.com/fit/overview
• Google fit sampleshttps://github.com/googlesamples/android-fit
API references• https://
developers.google.com/fit/android/reference
Thank You!!