SlideShare a Scribd company logo
1 of 28
Download to read offline
Google Fit
FiNC.Inc Yuki Nanri
Introduction
What you can learn today
What is Google Fit
How Google Fit works
Use Case in FiNC
Implementation
Recruitment
Introduction
• Yuki Nanri (@neonankiti)
• Bison
• FiNC Android Developer
What is FiNC
Digital Healthcare Company
We have various specialists
such as doctors, pharmacists,
personal trainers,
nutritionists, researchers, and
engineers
Introduction
What you can learn today
What is Google Fit
How Google Fit works
Use Case in FiNC
Implementation
Recruitment
What you can learn today
Whole Picture of Google Fit
Introduction
What you can learn today
What is Google Fit
How Google Fit works
Use Case in FiNC
Implementation
Recruitment
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
Introduction
What you can learn today
What is Google Fit
How Google Fit works
Use Case in FiNC
Implementation
Recruitment
How Google Fit Works
reference: https://developers.google.com/fit/overview
Components
• The Fitness Store
• The Sensor Framework
• Permissions and User Controls
• Google Fit APIs
Main Components of Google Fit
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)
Before Discussing APIs
There are 3 Fitness Data Types
• Public Data Types
• Private Custom Data Types
• Shareable Data Types
Fitness APIs
Sensor API
reference: https://developers.google.com/fit/android/
• read Raw Sensor in Real Time
• list Data Sources
• use Listeners
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
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
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
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
Introduction
What you can learn today
What is Google Fit
How Google Fit works
Use Case in FiNC
Implementation
Recruitment
Use Case in FiNC
Many Tasks that Logs Users Health
Weight Sleeping Time Food
Introduction
What you can learn today
What is Google Fit
How Google Fit works
Use Case in FiNC
Implementation
Recruitment
Steps
Step2 Use Location API
Step1 Create Google API Client
• add API Types
• add Scopes(Permission)
• add Callbacks
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();

}

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);

}

}


}

});
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
Introduction
What you can learn today
What is Google Fit
How Google Fit works
Use Case in FiNC
Implementation
Recruitment
Recruitment
・Good knowledge of Android Application
・Strong Coding Skills and Computer Science
 Fundamentals
・Experience Shipping Products
ç
FiNC.Inc Yuki Nanri
Thank You

More Related Content

What's hot

Architecture java j2 ee a partager
Architecture java j2 ee a partagerArchitecture java j2 ee a partager
Architecture java j2 ee a partager
aliagadir
 
Character stream classes introd .51
Character stream classes introd  .51Character stream classes introd  .51
Character stream classes introd .51
myrajendra
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
jaimefrozr
 

What's hot (20)

Architecture java j2 ee a partager
Architecture java j2 ee a partagerArchitecture java j2 ee a partager
Architecture java j2 ee a partager
 
Inheritance in OOPs with java
Inheritance in OOPs with javaInheritance in OOPs with java
Inheritance in OOPs with java
 
Java package
Java packageJava package
Java package
 
Java Applets
Java AppletsJava Applets
Java Applets
 
Character stream classes introd .51
Character stream classes introd  .51Character stream classes introd  .51
Character stream classes introd .51
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVMJava Virtual Machine (JVM), Difference JDK, JRE & JVM
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
 
OOP java
OOP javaOOP java
OOP java
 
Sessions in php
Sessions in php Sessions in php
Sessions in php
 
Telephony API
Telephony APITelephony API
Telephony API
 
Jsp Introduction Tutorial
Jsp Introduction TutorialJsp Introduction Tutorial
Jsp Introduction Tutorial
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
PHP - Introduction to PHP Date and Time Functions
PHP -  Introduction to  PHP Date and Time FunctionsPHP -  Introduction to  PHP Date and Time Functions
PHP - Introduction to PHP Date and Time Functions
 
Packages in java
Packages in javaPackages in java
Packages in java
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Training on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan SanidhyaTraining on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan Sanidhya
 
Introduction to Java Programming Language
Introduction to Java Programming LanguageIntroduction to Java Programming Language
Introduction to Java Programming Language
 
Control statements in java programmng
Control statements in java programmngControl statements in java programmng
Control statements in java programmng
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
Basic java important interview questions and answers to secure a job
Basic java important interview questions and answers to secure a jobBasic java important interview questions and answers to secure a job
Basic java important interview questions and answers to secure a job
 
Java applets
Java appletsJava applets
Java applets
 

Similar to Android Google Fit

Fitbit-Final Presentation
Fitbit-Final PresentationFitbit-Final Presentation
Fitbit-Final Presentation
Avik Das
 
Pearson Mobile App Development
Pearson Mobile App DevelopmentPearson Mobile App Development
Pearson Mobile App Development
zpinter
 

Similar to Android Google Fit (20)

Google Fit
Google FitGoogle Fit
Google Fit
 
Google app engine
Google app engineGoogle app engine
Google app engine
 
Fitbit-Final Presentation
Fitbit-Final PresentationFitbit-Final Presentation
Fitbit-Final Presentation
 
Integrating GoogleFit into Android Apps
Integrating GoogleFit into Android AppsIntegrating GoogleFit into Android Apps
Integrating GoogleFit into Android Apps
 
Pearson Mobile App Development
Pearson Mobile App DevelopmentPearson Mobile App Development
Pearson Mobile App Development
 
Exploring the Google Analytics API
Exploring the Google Analytics APIExploring the Google Analytics API
Exploring the Google Analytics API
 
Fire up your mobile app!
Fire up your mobile app!Fire up your mobile app!
Fire up your mobile app!
 
Presentation Day2.pdf
Presentation Day2.pdfPresentation Day2.pdf
Presentation Day2.pdf
 
#APIOps- Agile API Development powered by API Connect
#APIOps- Agile API Development powered by API Connect#APIOps- Agile API Development powered by API Connect
#APIOps- Agile API Development powered by API Connect
 
모바일 앱 개발 최종 발표 Proposal
모바일 앱 개발 최종 발표 Proposal모바일 앱 개발 최종 발표 Proposal
모바일 앱 개발 최종 발표 Proposal
 
Gits class #22: [ONLINE] Analyze Your User's Activities Using BigQuery and Da...
Gits class #22: [ONLINE] Analyze Your User's Activities Using BigQuery and Da...Gits class #22: [ONLINE] Analyze Your User's Activities Using BigQuery and Da...
Gits class #22: [ONLINE] Analyze Your User's Activities Using BigQuery and Da...
 
Accidental API developer - the 12 month pregnancy to create new API
Accidental API developer - the 12 month pregnancy to create new APIAccidental API developer - the 12 month pregnancy to create new API
Accidental API developer - the 12 month pregnancy to create new API
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
 
Google IO 2017 Recap
Google IO 2017 RecapGoogle IO 2017 Recap
Google IO 2017 Recap
 
What is new in Firebase?
What is new in Firebase?What is new in Firebase?
What is new in Firebase?
 
API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIs
 
Introduction to Digital Analytics for Apps - Trusted Conf
Introduction to Digital Analytics for Apps - Trusted ConfIntroduction to Digital Analytics for Apps - Trusted Conf
Introduction to Digital Analytics for Apps - Trusted Conf
 
Integrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowIntegrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business Workflow
 
Building Mobile (app) Masterpiece with Distributed Agile
Building Mobile (app) Masterpiece with Distributed AgileBuilding Mobile (app) Masterpiece with Distributed Agile
Building Mobile (app) Masterpiece with Distributed Agile
 
Introduction To Google Fit
Introduction To Google FitIntroduction To Google Fit
Introduction To Google Fit
 

Recently uploaded

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 

Android Google Fit

  • 2. Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
  • 3. Introduction • Yuki Nanri (@neonankiti) • Bison • FiNC Android Developer
  • 4. What is FiNC Digital Healthcare Company We have various specialists such as doctors, pharmacists, personal trainers, nutritionists, researchers, and engineers
  • 5. Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
  • 6. What you can learn today Whole Picture of Google Fit
  • 7. Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
  • 8. 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
  • 9. Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
  • 10. How Google Fit Works reference: https://developers.google.com/fit/overview
  • 11. Components • The Fitness Store • The Sensor Framework • Permissions and User Controls • Google Fit APIs Main Components of Google Fit
  • 12. 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)
  • 13. Before Discussing APIs There are 3 Fitness Data Types • Public Data Types • Private Custom Data Types • Shareable Data Types
  • 14. Fitness APIs Sensor API reference: https://developers.google.com/fit/android/ • read Raw Sensor in Real Time • list Data Sources • use Listeners
  • 15. 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
  • 16. 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
  • 17. 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
  • 18. 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
  • 19. Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
  • 20. Use Case in FiNC Many Tasks that Logs Users Health Weight Sleeping Time Food
  • 21. Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
  • 22. Steps Step2 Use Location API Step1 Create Google API Client • add API Types • add Scopes(Permission) • add Callbacks
  • 23. 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();
 }

  • 24. 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);
 }
 } 
 }
 });
  • 25. 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
  • 26. Introduction What you can learn today What is Google Fit How Google Fit works Use Case in FiNC Implementation Recruitment
  • 27. Recruitment ・Good knowledge of Android Application ・Strong Coding Skills and Computer Science  Fundamentals ・Experience Shipping Products