google-fit

Calories expenditure using google fit api

ぐ巨炮叔叔 提交于 2019-12-04 13:27:46
I am working on app fitness app , for that I used google fit api . Till now I am successful in fetching steps count , distance but I am unable to get calorie expenditure . Thanks in Advance You need to set the user's weight and height first. The expended calories are calculated using this information. These are the methods that I use to do this. (mClient is a GoogleApiClient instance) public static void saveUserHeight(int heightCentimiters) { // to post data float height = ((float) heightCentimiters) / 100.0f; Calendar cal = Calendar.getInstance(); Date now = new Date(); cal.setTime(now); long

Step Counter in Android: always on?

白昼怎懂夜的黑 提交于 2019-12-04 02:54:07
问题 It is a well known issue that many Android phones switch off the accelerometer when the screen goes off. However something seems to have changed with Android Fit (the app). Fit keeps counting steps even when the screen goes off. If Fit is installed, then events are raised for step counting within the Fit environment and I am able to capture them using Fitness.SensorsApi.findDataSources(mClient, new DataSourcesRequest.Builder() .setDataTypes(DataType.TYPE_STEP_COUNT_CUMULATIVE) I have tested

Not cheatable Google fit step counter

拥有回忆 提交于 2019-12-03 21:58:30
i have a question to Google Fit. I am creating a step counter (oh wonder g ). This i have already done so far and it not really hard. But now we come to my problem. I am only reading the steps with the Sensor API. The issue is, i can add new data via for example the Google Fit app and it will be counted in my app too. This introduces cheating and i do not want this. So i need to have a way to only read "device created" data and not manually added data. Is there a nice way to to this? From the SDK documentation it is not really clear how to proceed here. So i need to have a way to only read

Access Android Wear Fit Data

故事扮演 提交于 2019-12-03 06:18:09
I'm developing an app for Android Wear on Samsung Gear Live (Google I/O Edition) where it will need access heart rate and steps count history data. I know that later this data might be accessible using Google Fit SDK , but is it possible to read that data without using that SDK right now? I would prefer to access this data without ROOTing my G Watch. Here are the screenshots of the historical data that I would like to extract: Steps History data: Heart Rate History Data: UPDATE 10/28/2014 Google Release Google Fit SDK Available on the Official website I guess the only option right now is for

Using google fit api from a backend server

偶尔善良 提交于 2019-12-02 20:22:36
问题 I'm writing an android application which needs to read user's fitness data (steps, calories, etc) from a back end server. this server will read the data and push notifications to android app if necessary. I managed to get the authentication part done and app is now sending the code recevied from oauth flow to the backend server (followed this example) and the server successfully exchanges the code access and refresh tokens. The problem is I did not find any resource on how to access the

Google fit permission problems

本秂侑毒 提交于 2019-12-02 15:41:08
问题 I would like to get some technical help with the google fit rest Rest API. I am making an app that requires access to the location information and as a response for my request I am getting this json. { "access_token": "ya29.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "scope": "https://www.googleapis.com/auth/fitness.activity.read https://www.googleapis.com/auth/fitness.location.write https://www.googleapis.com/auth/fitness.location.read

GoogleFit Sample Not Working

萝らか妹 提交于 2019-12-02 14:35:58
问题 I am trying the BasicHistory Sample whis stores a data and then read it but in my case the code get stuck at the insert call.await call does not return anything i have tried using the asynchronous way also,here is the code com.google.android.gms.common.api.Status insertStatus = Fitness.HistoryApi.insert(mClient, insertRequest).await(1, TimeUnit.MINUTES); 回答1: Have you requested the right permissions? According to that Google Fit sample, it only requires permission for "Activity". If you

Google Fit API : Get distance from google fit

人盡茶涼 提交于 2019-12-02 14:28:16
问题 How do I calculate the distance covered by the user using the google fit API? Currently I am using google Fit History Api like this : DataReadRequest readRequest = new DataReadRequest.Builder() .aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA) .bucketByTime(1, TimeUnit.DAYS) .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS) .build(); DataReadResult dataReadResult = Fitness.HistoryApi.readData(mGoogleApiClient, readRequest).await(1, TimeUnit.MINUTES); But this

Google fit API, onDatapoint method is not being invoked

别来无恙 提交于 2019-12-02 13:20:27
I am not able to get step count. I've been stuck on getting the onDataPoint method to be called. This code is almost correct. I am not able to find why it is not showing step count. package com.example.akkisocc.heath; import android.content.Intent; import android.content.IntentSender; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.Scopes; import com.google.android.gms.common.api

Google fit permission problems

牧云@^-^@ 提交于 2019-12-02 12:46:51
I would like to get some technical help with the google fit rest Rest API. I am making an app that requires access to the location information and as a response for my request I am getting this json. { "access_token": "ya29.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "scope": "https://www.googleapis.com/auth/fitness.activity.read https://www.googleapis.com/auth/fitness.location.write https://www.googleapis.com/auth/fitness.location.read https://www.googleapis.com/auth/fitness.body.read", "token_type": "Bearer", "expires_in": 3600, "refresh