Join the community to talk, learn about and discuss the Google Fit APIs. See our docs, FAQ and known issues on the info link above.
See all
Members (6,777)
Bill Strathearn's profile photo
Matt Sullivan's profile photo
Gouri Joshi's profile photo
Muz Mostofi's profile photo
Gustavo Moura's profile photo
Paul Saxman's profile photo
Google Developers's profile photo
Lisa Wray's profile photo
Satinder Singh's profile photo
Uren “Stonecold” Patel's profile photo
陳凱文's profile photo
Mausam Sharma's profile photo
Nicola Horley's profile photo
Taras Bazyshyn's profile photo
ahmet burak demirkoparan's profile photo
Franco Barbieri's profile photo
Adam Stroud (adstro)'s profile photo
官哲宇's profile photo
Steven Anderson's profile photo
Gyuri Grell's profile photo
ada koda's profile photo
william garcia's profile photo
Sil viu's profile photo
Abel García Dorta's profile photo

Stream

Join this community to post or comment
Pinned by moderator

Muz Mostofi
moderator

Announcements  - 
 
Hello everyone,

We've added some common scenarios to our developer site for various use cases such as recording+reading steps, writing+reading nutrition & hydration.

Please do take a look, hope this makes it clearer how to use our APIs for certain use cases.

https://developers.google.com/fit/scenarios/record-steps
https://developers.google.com/fit/scenarios/add-nutrition-data
https://developers.google.com/fit/scenarios/add-hydration-data
https://developers.google.com/fit/scenarios/read-daily-nutrition
6
Add a comment...
 
Hi All,

How can I make the google fit REST API calls from Android device?
Or at least how can I get the access token in my app upon authentication and later I can send that access token to my backend , and then backend can make REST API calls.

Please advice how to get the access token from my android app. 
1
Satyendra Mishra's profile photoAniruddha Kulkarni's profile photo
2 comments
 
Thanks. My question is how can I get access token in mobile?
Add a comment...

Raushan Singh

Discussion  - 
 
Hello All,
I need some information about the limit to the number of requests you can make to the google fit API. I know that there is a limit for the rest Api, but does the same limit apply to the android sdk or the android sdk part is unlimited.
And if there is a limit ,How can i increase it and how much would i have to pay.?
Thank You

2
Raushan Singh's profile photoJerry Grant's profile photo
3 comments
 
Your Welcome
Add a comment...
 
Hi Guys, I'm playing around to feed the data of my ant+ based heart rate monitor into google fit for better tracking of my workouts.
As Google fit itself is not capable of accessing it I am exploring ways to get this done.
Right now I'm thinking of creating my own implementation of https://developers.google.com/android/reference/com/google/android/gms/fitness/service/FitnessSensorService that just relays the information and I would just start that along google fit during the workouts. But the plumbing etc. is quite a lot of work if you're not an android developer as a day job ;-)

Is someone here who has done something like this by chance?

1
Add a comment...
 
Not everyone uses Fit for activity detection. One of my apps is used by people who have a Samsung phone or Samsung wearable that doesn't communicate directly with Fit, but with S Health. Some of them want their health data in Fit (that's what my app does), but they don't want Fit to detect activities, because that duplicates or disturbs activities recorded by S Health.

My idea: don't continuously show in the main screen of Fit a message to turn Activity Detection on (when you didn't turn it on). It's ugly, it is not needed and it doesn't show the freedom to Fit users to use the app as they want. 
5
Guillaume A. REQUIER's profile photoHielko Ophoff's profile photo
8 comments
Add a comment...

Sreedhara Murthy

Bug Reports  - 
 
I use Lenovo K4 Note(Android 6.01), Google FIT crashes after 30 secs every time I launch the app, any clues .. 
1
Rutger van Houtert's profile photo
 
Same here for some months now on a BQ A4.5 Androidone phone. Performed a factory reset today, but without any luck. Hoping for a solution
Add a comment...
 
ifttt and Google fit.. Think it! Perfect 
1
Add a comment...

David Schmidt

Bug Reports  - 
 
Also, why are there two Sep 9th?
2
Bill Strathearn's profile photo
 
Thanks for the report David. This is a bug that we expect to be resolved in the next release of Google Fit. 
Add a comment...
 
Hi!

I have a strange with the calories value. For example, in my app I insert 1000 calories and read 1000 calories, it´s ok but in google fit server and other devices with the same account I read 534 calories, why?

Thanks
1
Add a comment...
 
Feature request start more activities on Androidware

Would be nice in Androidwear to be able to 'start' more activities. I would like to see Weight lifting, or Circuit training, but have to get my phone out to initiate other activities.

It would also be nice for fit/androidwear to start <Jump Rope>, and then count the skips.

And allow fit to just start and count sit-ups, push-ups without the challenge.


1
Erwin Dirkx's profile photo
 
I would love this for Pebble too.
Add a comment...
 
Hi guys,
we'd like to implement Integration with Google Fit in our application and I’m currently investigate REST API. For a few last days I’ve played in playground and have a few questions:


1) which logic stays behind GF aggregate dataset?
Lets say I’d like to get number of user’s calories spent over day, and there are multiple sources which writes data to GF:
GF activity calories
GF bmr calories
GF merged calories

third party integration1 calories
third party integration2 calories
What is returned by API when I request aggregate dataset for “com.google.calories.expended” datatype?



2) how to get details about workout?
Lets say user had a few runs over day. How to get details about each workout(duration, name, start/end time, calories spent)? I assume that first I have to request sessions information (...dataSources/dataset:aggregate, "dataTypeName": "com.google.activity.segment”) and then workout information based on data from session (...dataSources/{datasourceId}/{startTime}-{endTime}). When I tried this scenario I get not empty response for session info but workout data is empty. 
1
Add a comment...

About this community

The Google Fit Developers group is a community for motivated developers who are interested in our Fitness APIs. Here, you can post questions, comments, or just your general enthusiasm for the Google Fit team!
 
I've been experiencing authentication problem since migrating project to Firebase and new play-services-auth.

The data for some users will not sync at all and they get authentication problem saying that it requires Oauth from the user even after they already authorized. Some users have tried removing access from within the Google fit app and re-authorizing my app and still have the same problem.

Edit: this does not happen to all users...

Here is a gist for authenticating Google Fit:
https://gist.github.com/fnk0/facd2a72f47614350c1490a884fda598

Any ideas? 
1
Hielko Ophoff's profile photoMarcus Vinicius Andreo Gabilheri's profile photo
2 comments
 
I've noticed that it fixes itself sometimes, but the problem is that some users are never authorized (not even once).
Add a comment...

Juego Sreeraj

Bug Reports  - 
 
HI All,
Am trying to get the step count using history api and my app is getting crashed by the time

PendingResult<DailyTotalResult> result = Fitness.HistoryApi.readDailyTotal(mApiClient, DataType.TYPE_STEP_COUNT_DELTA);
(This part is working fine )

DailyTotalResult totalResult = result.await(30, TimeUnit.SECONDS);(But when this line is executing its getting crashed)

Any help ??
1
Roman Kirillov's profile photo
 
What's the stack trace look like?
Add a comment...
 
Hi All,
Need help to get the exact number of steps being displayed in official Google-Fit app. I get the exact number of steps using

DailyTotalResult result = Fitness.HistoryApi.readDailyTotal

but not when I want to get the steps for last one week. The steps retrieved are in no match with what is being displayed in Google-Fit app. I'm using the below to get the number of steps for last week.

DataSource ESTIMATED_STEP_DELTAS = new DataSource.Builder()
.setDataType(DataType.TYPE_STEP_COUNT_DELTA)
.setType(DataSource.TYPE_DERIVED)
.setStreamName("estimated_steps")
.setAppPackageName("com.google.android.gms")
.build();

DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(ESTIMATED_STEP_DELTAS, DataType.TYPE_STEP_COUNT_DELTA)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();

DataReadResult dataReadResult = Fitness.HistoryApi.readData(mGoogleApiClient, readRequest).await(1, TimeUnit.MINUTES);


Please help
1
Add a comment...

Jason Burke

Discussion  - 
 
 
Well, they sure do help. 
Wearing an activity device that counts how many steps you have taken does not appear to improve the chances of losing weight, research suggests.
1
Patrick Cornelißen's profile photo
 
it's like a membership in a gym, in itself it doesn't help you to feel better... ;-)

Add a comment...

Hielko Ophoff

Bug Reports  - 
 
Steps are not always shown when added from external source via History API. With my app I sync step data from other sources (Samsung Gear smart watches), users of the app don't use Activity Detection in Fit, because activity recording is done in the external app (S Health), but they want to see the data in Fit. Often I see that steps that are synced very early in the morning that correctly are stored in Fit, are not shown in Fit (not in the web app, nor in the Android app). With steps recorded during the day and in the evening there is never a problem.
Concrete case: following steps are stored in Fit using the History API, I'm sure they are stored in Fit, because when I query them in Fit I see them:
- Sep 15, 2016 - 04:00 - 9 steps
- Sep 15, 2016 - 08:20 - 33 steps

The first 9 steps are missing in the day count in Fit. And they will remain missing for the rest of the day, while the 33 steps and all the steps that are stored later this day, are counted correctly. There are no other sources for steps in this test situation, activity detection is disabled and there are no other apps than my sync app connected to Fit.

This happens often, I didn't see it when the first steps in the day are later in the morning, but early in the morning they are skipped in some way. Timezone in my personal test situation is UTC+2.
1
Add a comment...

Andras LOHF

Bug Reports  - 
 
Having an old issue again where the app will not show current information. It only shows information from 2 days ago. This is on a fresh install of Nougat and I choose to set the device up as new not restoring any information.
3
Andras LOHF's profile photo
 
New Play Services fixes the issue.
Add a comment...

David Schmidt

Discussion  - 
 
Why does Fit often do not recognize the same activity as Maps? I was riding a bike yesterday on my way downtown, Fit believes I was walking...
2
Add a comment...
 
Hi All,

I have heard that Mi-Fit lets user sync their fitness data with Google Fit once they connect to Google account. In this case, is there any Google Fit API which could give the Mi-Fit data?


1
Aniruddha Kulkarni's profile photoHielko Ophoff's profile photo
3 comments
 
In Fit you will (as far as I know) always get the steps combined from all original datasources. By selecting the orginal data source you can filter on the app. If someone knows how to retrieve the steps directly from one source then I would like to know how to do this.
Add a comment...

Abdullah khan

Discussion  - 
 
Hi Google Fit devs,

1) I have the problem in reading steps from history API. While reading steps when no manual activity is added. I get actual sensor recorded steps with a stream "soft_step_counter", but when manual activity is entered all I get is merged steps with "user_input" stream and I can't differentiate between manual steps and actual sensor recorded steps.
2) How to read exact steps that is shown in google fit.
Please help with some working code.

2
Aniruddha Kulkarni's profile photo
 
Even, I would like to know how to differentiate the actual steps and manually entered steps from History API. If you find anything, please share.

For 2nd question this would help :
PendingResult<DailyTotalResult> result =
HistoryApi.readDailyTotalFromLocalDevice(client, TYPE_STEP_COUNT_DELTA);

Add a comment...