google-fit-sdk

Google Fit API, getting calories burned per activity

这一生的挚爱 提交于 2019-12-19 02:37:10
问题 So I'm trying to create an app that connects to Google Fit and shows the user their data in a pretty streamlined way and I'm having trouble finding the calories the user burned for each individual activity per day. I can get the total calories for the entire day, and each activity the user did each day, but not the calories burned for each activity. Link to GitHub: https://github.com/drb56/FitTest I've only added the java code not any of the xml stuff. And the Google Fit code is in the

Unable to Connect To GoogleFit

三世轮回 提交于 2019-12-18 09:22:11
问题 I am trying to connect to Googlefit but i am getting a strange error code as below E/GooglePlayServicesUtil﹕ Unexpected error code 5005 Does anybody have any idea about this.Thanks In advance 回答1: I solved the error with the help of the answer in this post: https://stackoverflow.com/a/28391583/2977169 @Sumoanand: I also faced similar problem. This issue occurs if app is not registered properly in google developer console. I think you have registered app on Google developer Console using

Google fit Recording API delay

对着背影说爱祢 提交于 2019-12-18 08:56:41
问题 So I'm writing a fitness application for android. I'm using the Google fit API to count the steps. I'm using the Recording API to count the steps when the app is in the background. Once the app is in the foreground I'm fetching the steps count with the History API to show it on the screen. What happens is that the count is not correct. There is a delay until you get the correct and updated count. To be more specific no data is being lost. I guess that the Recording API is updating with a

Calories expenditure using google fit api

瘦欲@ 提交于 2019-12-14 03:42:12
问题 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 回答1: 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)

Google fit api steps returns 0 for some users

心不动则不痛 提交于 2019-12-12 03:38:30
问题 I am developing an android app that will count steps for users. I am using google fitness api to do so. I have enabled fitness api in my developer console and link my app to that. When I install the app in my device, it works perfectly showing me my steps. However if I install it on another device, it does not show any steps(steps returned are 0). Do you have any suggestions on what might be the problem? The email I declared when I enabled the fitness api in my developer console is the same

Google FIT api returns different step counts

我怕爱的太早我们不能终老 提交于 2019-12-12 02:17:35
问题 Stepcount is different when accessed by getDailyTotal and getData bucketed by day. Please help. Fitness.HistoryApi.readDailyTotal(App.gClient, DataType.TYPE_STEP_COUNT_DELTA) -> returns step count as 1515 private void getStepsDataHistory(long startTime, long endTime) { DataReadRequest dataReadRequest = new DataReadRequest.Builder() .bucketByTime(1, TimeUnit.DAYS) .aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA) .setTimeRange(startTime, endTime, TimeUnit

java.lang.IllegalStateException: Must specify a valid bucketing strategy while requesting aggregation

ぐ巨炮叔叔 提交于 2019-12-12 01:43:44
问题 I get this error while I am creating a read request object DataReadRequest class. I tried to look for the documentation but it is unclear. Here is my code: DataReadRequest readRequest = new DataReadRequest.Builder() .read(DataType.TYPE_LOCATION_SAMPLE) .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS) .bucketByTime(1, TimeUnit.HOURS) .build(); The error is in bucketByTime method and I don't know how to proceed. 回答1: I had this error before. The short answer is to remove the line

DataSource.getAppPackageName() always returns “com.google.android.gms” in Google Fit

断了今生、忘了曾经 提交于 2019-12-11 09:59:28
问题 My app is reading weight data from Google Fit. The data were inserted by Withings and by my own app. But this doesn't make any difference when I call dataSet.getDataSource().getAppPackageName() , because it always returns com.google.android.gms . So I have no chance of knowing where the data came from. Google describes how to get information of the data source in this article: https://developers.google.com/fit/android/data-attribution Unfortunately this is completely useless to me. I'm using

How to retrieve daily running and walking steps from Google Fit API

*爱你&永不变心* 提交于 2019-12-11 02:43:56
问题 It is probably a newbie question but I have lost a one day to figure out w/o success. I'm using Google Fit API into my Android app and I need to show some of its data like running and walking daily steps. I have managed to show data but in time unit (f.e running in x min). I need to show it in steps unit. The snipped below code shows how I retrieved data as time unit (in milliseconds): DataReadRequest readRequest = new DataReadRequest.Builder() .aggregate(DataType.TYPE_ACTIVITY_SEGMENT,

How do I get the steps from Google Fit API?

非 Y 不嫁゛ 提交于 2019-12-11 01:27:08
问题 Pardon noobiness, I am completely new to Android, and Google APIs. I have the following code that connects to GoogleFit. I also have an API key and Oauth. Where/how do i use API key and Oauth? Lots of guides on how to obtain them but zero info on where to put them/how to use them in the app. And how do I actually use the steps returned. I set up a global: private int steps; and then try to set it via: steps = (int)total; but it does nothing. Here is the rest of the function. How do I actually