google fit

23

Upload: vishal-nayak

Post on 13-Jan-2017

213 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Google Fit
Page 2: Google Fit

Contents• Platform Basics• Google Fit on Android• Storing and Accessing Fitness Data• Using Sensors• Demo• References

Page 3: Google Fit

Platform Basics

Page 4: Google Fit

Overview

Page 5: Google Fit

Architecture

Page 6: Google Fit

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.

Page 7: Google Fit

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.

Page 8: Google Fit

Google fit on Android

Page 9: Google Fit

Overview

Page 10: Google Fit

API Classification

Sensors API

Recording API History API

Sessions API

Bluetooth Low energy

API

Page 11: Google Fit

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.

Page 12: Google Fit

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

Page 13: Google Fit

Storing and accessing fitness data

Page 14: Google Fit

Recording Fitness Data

Page 15: Google Fit

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.

Page 16: Google Fit

Read Fitness data

Page 17: Google Fit

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.

Page 18: Google Fit

Using sensors

Page 19: Google Fit

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.

Page 20: Google Fit

Register for real time sensor data

Page 21: Google Fit

Demo Time

Page 22: Google Fit

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

Page 23: Google Fit

Thank You!!