android google fit
TRANSCRIPT
![Page 1: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/1.jpg)
Google Fit
FiNC.Inc Yuki Nanri
![Page 2: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/2.jpg)
Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
![Page 3: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/3.jpg)
Introduction
• Yuki Nanri (@neonankiti) • Bison • FiNC Android Developer
![Page 4: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/4.jpg)
What is FiNC
Digital Healthcare Company
We have various specialists such as doctors, pharmacists, personal trainers, nutritionists, researchers, and engineers
![Page 5: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/5.jpg)
Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
![Page 6: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/6.jpg)
What you can learn today
Whole Picture of Google Fit
![Page 7: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/7.jpg)
Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
![Page 8: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/8.jpg)
What is Google Fit
The Healthcare Platform Sharing Data Through APIs
• aggregates Any Kind of Healthcare Data
• shares Them with APIs
• can Access from Multiple Platforms
• keeps Some Records automatically
![Page 9: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/9.jpg)
Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
![Page 10: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/10.jpg)
How Google Fit Works
reference: https://developers.google.com/fit/overview
![Page 11: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/11.jpg)
Components
• The Fitness Store
• The Sensor Framework
• Permissions and User Controls
• Google Fit APIs
Main Components of Google Fit
![Page 12: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/12.jpg)
Points of Today
Focus on Fitness APIs
reference: https://developers.google.com/fit/android/
• Sensor API
• Record API
• History API • Session API
• Others(BLE, Config APIs)
![Page 13: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/13.jpg)
Before Discussing APIs
There are 3 Fitness Data Types
• Public Data Types
• Private Custom Data Types
• Shareable Data Types
![Page 14: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/14.jpg)
Fitness APIs
Sensor API
reference: https://developers.google.com/fit/android/
• read Raw Sensor in Real Time
• list Data Sources
• use Listeners
![Page 15: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/15.jpg)
Fitness APIs
reference: https://developers.google.com/fit/android/
• store Data of Sensor by Subscriptions.
• use Multiple Subscriptions at the same time
• the Data Stored will be Here Used from History API
Record API
![Page 16: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/16.jpg)
Fitness APIs
reference: https://developers.google.com/fit/android/
• can Use Reading, Inserting and Deleting Data
• can Use Synchronously and Asynchronously
• arrange Period Freely
History API
![Page 17: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/17.jpg)
Fitness APIs
Session API
reference: https://developers.google.com/fit/android/
• create Session with Record API
• read Fitness Data Using Session
• show Sessions in Other Apps
• use Session Broadcast Intents
![Page 18: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/18.jpg)
Preparation
reference: https://developers.google.com/fit/android/
• Install Google Play Services
• Get a Google Account
• Create an OAuth Client ID
• Register the Public Certificate
• Add Google Play Service in Build Gradle
• Enjoy Fit APIs !!
All You Have to Do is
![Page 19: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/19.jpg)
Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
![Page 20: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/20.jpg)
Use Case in FiNC
Many Tasks that Logs Users Health
Weight Sleeping Time Food
![Page 21: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/21.jpg)
Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
![Page 22: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/22.jpg)
Steps
Step2 Use Location API
Step1 Create Google API Client
• add API Types • add Scopes(Permission) • add Callbacks
![Page 23: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/23.jpg)
Step1 Create Google API Client
private void buildFitnessClient() { mClient = new GoogleApiClient.Builder(this) // can add multiple api types .addApi(Fitness.SENSORS_API) .addApi(Fitness.RECORDING_API) .addApi(Fitness.HISTORY_API) // can add multiple scopes .addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE)) .addScope(new Scope(Scopes.FITNESS_LOCATION_READ)) .addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE)) .addScope(new Scope(Scopes.FITNESS_BODY_READ_WRITE)) // .addConnectionCallbacks( new GoogleApiClient.ConnectionCallbacks() { @Override public void onConnected(Bundle bundle) { Log.i(TAG, "Connected!!!"); // use fitness apis freely!! } @Override public void onConnectionSuspended(int i) { } } ) .addOnConnectionFailedListener( new GoogleApiClient.OnConnectionFailedListener() { // Called whenever the API client fails to connect. @Override public void onConnectionFailed(ConnectionResult result) { } } ) .build(); }
![Page 24: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/24.jpg)
Step2 Use Location API
Fitness.SensorsApi.findDataSources(mClient, new DataSourcesRequest.Builder() // at least one datatype must be specified. .setDataTypes(DataType.TYPE_LOCATION_SAMPLE) .setDataSourceTypes(DataSource.TYPE_RAW) .build()) .setResultCallback(new ResultCallback<DataSourcesResult>() { @Override public void onResult(DataSourcesResult dataSourcesResult) { for (DataSource dataSource : dataSourcesResult.getDataSources()) { Log.i(TAG, "Data source found: " + dataSource.toString()); Log.i(TAG, "Data Source type: " + dataSource.getDataType().getName()); if (dataSource.getDataType().equals(DataType.TYPE_LOCATION_SAMPLE) && mListener == null) { Log.i(TAG, "Data source for LOCATION_SAMPLE found! Registering."); registerFitnessDataListener(dataSource, DataType.TYPE_LOCATION_SAMPLE); } } } });
![Page 25: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/25.jpg)
Step2 Use Location API
private OnDataPointListener mListener;
private float latitude, longitude, altitude, accuracy; private void registerFitnessDataListener(DataSource dataSource, DataType dataType) { mListener = new OnDataPointListener() { @Override public void onDataPoint(DataPoint dataPoint) { for (Field field : dataPoint.getDataType().getFields()) { final Value val = dataPoint.getValue(field); Log.i(TAG, "Detected DataPoint field: " + field.getName()); Log.i(TAG, "Detected DataPoint value: " + val); switch (field.getName()) { case "latitude": latitude = val.asFloat(); break; case "longitude": longitude = val.asFloat(); break; case "altitude": altitude = val.asFloat(); break; case "accuracy": accuracy = val.asFloat(); break; } } runOnUiThread(new Runnable() { @Override public void run() { latitudeView.setText(String.valueOf(latitude)); longitudeView.setText(String.valueOf(longitude)); altitudeView.setText(String.valueOf(altitude)); accuracyView.setText(String.valueOf(accuracy)); } }); } }; //register listener
![Page 26: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/26.jpg)
Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
![Page 27: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/27.jpg)
Recruitment・Good knowledge of Android Application
・Strong Coding Skills and Computer Science
Fundamentals
・Experience Shipping Products
![Page 28: Android Google Fit](https://reader030.vdocuments.mx/reader030/viewer/2022020301/5889de341a28ab83478b6be9/html5/thumbnails/28.jpg)
ç√
FiNC.Inc Yuki Nanri
Thank You