Thursday, October 20, 2016

Google Fit Integration Pedometer Data -Step by Step and Issues-

  1. Use History API for sending step count to google fit.
  2. Geneate Auth 2.0 ID by following steps in the below given Link.
    1. While you are in debug mode no need to bother about debug certificate
    2. Follow steps from the heading  :- Request an OAuth 2.0 client ID in the Google API Console
    3. To get SHA-1 certificate follow steps in this link
    4. Use your applications base package name which is available in manifest
    5. After creating key leave it . No need to copy it or configure it in project files like manifest or gradles. 
  3. Make sure FitnessAPI is enabled. This can be verified at dashboard of your project in google api console
  4. Start with copying sample code in to your Activity. Activity must be derived from ActivityFragment or AppCompactActivity . Otherwise it is not possible to use enableAutoManage. If you are not using that you have to many extra steps to connect with google accounts etc.
  5. If you are getting  ConnectionResult -> CANCELLED then there is chances your package name not correct
  6. if you are getting  statusCode=Application needs OAuth consent from the user then you are missing some scope 

.addScope(new Scope(Scopes.FITNESS_LOCATION_READ))
.addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE))

No comments: