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 (5,242)
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
Oleg Soyko's profile photo
Alejandro Tellez's profile photo
Antowka Nene's profile photo
Tasnia shawon's profile photo
Jorge Castillo Pérez's profile photo
Ombretta Mancini's profile photo
Ivo Ribeiro's profile photo
Cristi Istrate's profile photo
Gyuri Grell's profile photo
Rida “Ikki” Ichigo's profile photo
william garcia's profile photo
Lose Diet Weight's profile photo
ada koda's profile photo
Ward Weistra's profile photo
Brandy Skinner's profile photo

Stream

Join this community to post or comment
Pinned by moderator

Muz Mostofi
moderator

Announcements  - 
 
Hello Google Fit Developers,

Based on your feedback, we updated the HistoryApi.readDailyTotal() method in Google Play Services 8.3 to allow you to read consistent step counts between the Google Fit app and Android Wear watch faces. Please see the following documentation for more detail:
https://developers.google.com/fit/android/history#read_daily_total_data
https://github.com/googlesamples/android-WatchFace

14
Nico Westerdale's profile photoBill Strathearn's profile photo
12 comments
 
PHP is one of the few languages that I don't know and haven't tried, but when I Cntl+F for aggregate in this file, it seems to be configured to use that method: https://github.com/google/google-api-php-client/blob/v1-master/src/Google/Service/Fitness.php
Add a comment...

Pierre Benayoun

Discussion  - 
 
OK Fit developers,

In my bog this week I discuss a problem we all have:
With all this Fit Data, what advice can I give to the user?
http://goo.gl/OdrzM7

2
Add a comment...

Stefan Berglund

Discussion  - 
 
Hi,

I understand I can use the Recording API to also start recording heart rate data on my Wear watch. But what recording frequency is used (how often), and can I influence this frequency?

Thanks
/Stefan 
1
Add a comment...
 
 
Does anyone know how to "force" a sync between the phone App and the website? Mine hasn't updated the website for 2 days.
1
Add a comment...
 
I've problem with add activities in fit. 4 example, I did 30 minutos in ergometric bike, I measure in y own bike 304Kcal, if I add this in fit, the app decreases other acitivit (walf for example). In resume of all activities of the day, show 150Kcaa of ergometric bike, but if I open the activit of bike, shows the 304 Kcal
1
Add a comment...
 
Hi,

I am currently creating an app that integrates fitbit data into google fit and uses it in my app. When I pull the data I can get numerous days with step data, so I make a new Session for each day. Each Session is exactly the same, except for the number of steps in each and the start and end time. After inserting these Sessions and checking the Google Fit app I only see the Session information on the last inserted session. The others just show the number of steps that day with no information on where they came from. If I click the graph details I see that it came from my app, but I am using the session to describe to the person that it is the import from fitbit. Is there a reason this is happening?
1
Add a comment...

Janwel Ocampo

Announcements  - 
 
Hi Google Fit Developers,

Just a question, I am having a hard time passing my data on google fit app. I have same data and I used galaxy S4 S5 and S6. Based on my observation, S4 and S5 successfully sends the data while on S6 it is saying

Status{statusCode=ERROR_OPERATION_FAILED, resolution=null}

What seems to be the problem on S6?
1
Janwel Ocampo's profile photoAllen Thomas Varghese's profile photo
2 comments
 
Did you check the google play services version?
Add a comment...

Vlad Vlaicu

Bug Reports  - 
 
Hi there,

I am unable to access fit.google.com as I am always getting internal server error 500.

I've tried different browsers, different computers, different internet connections.
It seems to be account related since other people next to me are able to access it, but as soon as I login, i'm getting the error.

The Google Fit app on my Android works just fine.

Any known workarounds or maybe some thoughts from Google engineering? I'm pretty sure this is a server side error.
1
Gouri Joshi's profile photo
Add a comment...

Pierre Benayoun

Announcements  - 
 
Dear Fit developpers,

In my blog this week I discuss adaptation of old code that managed Fit API. The first code was an hell to develop on Android, so was it difficult to adapt to my new app ? (clue in the gif)
http://www.frandroid.com/blogs/vmvdd/2016/01/1175-potw-012916-easy/



1
Lewis McGeary's profile photoPierre Benayoun's profile photo
4 comments
 
+Lewis McGeary : Thanks ! ;)
Add a comment...
 
 
Why on the desktop version when you view the map from activity it just shows a circle around the are you have ran, not a route covered/ Yet on the mobile app it shows the route? 
1
Gouri Joshi's profile photo
Add a comment...

Nicola Tesone

Bug Reports  - 
 
Here, my problem. I don't use Bicycle... i don't have...
1
Alexander Gee's profile photoGouri Joshi's profile photo
8 comments
 
Hi +Nicola Tesone,  Are these motor bike rides? 
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 am using the History API to get user steps for each day for the past month. Currently I am using the method readData to get the steps where the read request is as follows:
new DataReadRequest.Builder()
.aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();

startTime = midnight 30 days back
end time = now

The step count I am getting is not consistent with what google fit app shows me.
I read in an earlier post that we must use readDailyTotal to get consistent data but how do I get data from previous days using that. Anybody has any suggestions?

PS: I am building an app for the phone, I have google fit downloaded and the app has also subscribed to record steps.
1
shambhavi punja's profile photoJosh Lovatt's profile photo
4 comments
 
I have not tryed with any other type as my project only deals with steps. I could only assume it would work though. Glad I could help.
Add a comment...
 
Hi,
could someone please explain to me how i can read the latest weight from google fit. I am struggling to unterstand how to do this.

It's easy enough to get the total step count with a call like:
Fitness.HistoryApi.readDailyTotal(mClient, DataType.TYPE_STEP_COUNT_DELTA);

But somehow a similar call like the following returns a empty Dataset:
Fitness.HistoryApi.readDailyTotal(mClient, DataType.AGGREGATE_WEIGHT_SUMMARY);
1
Add a comment...
 
I am still struggling with the fact that if you don't use the Fit app on the phone the data collection stops. I understand why this has been done, but can't figure out how to deal with it.

My app uses the History API and so is dependant on the Fit app continuing to provide data. If it stops it means the user has to be aware of what has happened and go into the app to re-enable it. Otherwise my app receives no data.

If all is good the user uses both apps and the problems doesn't occur and following the previous discussion using Fit on an Android wear device also overcomes the issue.

However, if that doesn't happen I can't see anything I can use in my app to detect that this has happened and take appropriate action.

My only alternative is to run the following say once a week.

PackageManager pm = ThinQStepsApplication.getContext().getPackageManager();
try
{
String packageName = "com.google.android.apps.fitness";
Intent launchIntent = pm.getLaunchIntentForPackage(packageName);
startActivity(launchIntent);
}
catch (Exception e1) {

Log.d(TAG, "start Fit App failed");
}

Which is a horrible approach.

Can anyone help or shed any light on the subject?
3
Daniele Segato's profile photoPaul Gullett's profile photo
11 comments
 
+Ian Lake Mark me down as a muppet, the penny just dropped after your comment to +Daniele Segato. I had already implemented the subscribe without really understanding what I was doing that for. I had thought that I needed to use Fitness.SensorsApi.findDataSources() with associated listeners to gather data. I know see that I do not need that or the Fit app to gather data for me provided I use subscribe. Apologies.
Add a comment...
 
 
With Google Tracks being killed, will Fit get all the great map tracking features or are we to be left high and dry
1
Add a comment...
 
Hi Everyone,

I have a query. I am implementing google fit apis in my app. But the data received by the api is not consistent with the google fit app. I was calculating the steps and the both the data have a difference of about 15-20%. Data is also missing for some dates in the apis response.

I followed the code using this sample https://github.com/googlesamples/android-fit/tree/master/BasicHistoryApi

Any suggestions?
1
Add a comment...

Stefan Berglund

Discussion  - 
 
Hi,

I'm developing a watch face for Android Wear and I'm having problems with accessing daily total data for distance.

I'm using the HistoryApi.readDailyTotal() to access both step counter and distance daily total. For step counter it works well and my step data seem consistent with Fit app.

But the distance data seem to only take some local data for the watch only. When I use the Fit app on the watch I can see the same distance data as I see on Google Fit app on the phone, but when using  HistoryApi.readDailyTotal(TYPE_DISTANCE_DELTA) from the watch face I get some other data that is not consistent with what I can see in the Fit apps. 

It looks like the distance data I get over readDailyTotal is some sort of local data that is calculated locally on the watch. I use Play Services 8.3.

Anyone knows how to get the correct daily distance count?
1
Gouri Joshi's profile photoStefan Berglund's profile photo
2 comments
 
+Gouri Joshi​ Ok, thanks.

Hopefully it's not too long until this is implemented. It's very hard to explain to users that it's the way it's supposed to work when the distance number on the Google Fit "micro-app" is not the same as the watch face.

I could have explained it if there consistently was different number between phone and watch, but now the correct number is shown in the Google Fit microapp on the watch but not in the watch face. 
Add a comment...
 
I am currently learning how to use google fit. I did follow all steps from in get started guide: https://developers.google.com/fit/android/get-started

I did set up OAuth2 client id, have checked package name and SHA1 number many times. 

I have used this project as example: https://github.com/googlesamples/android-fit/blob/master/BasicSensorsApi/app/src/main/java/com/google/android/gms/fit/samples/basicsensorsapi/MainActivity.java 
Done almost everything similar except log stuff.  

So I now have issue:
1. When I start app, I see account picker
2. After I select account, window disappears and I get following messages: 

W/GmsSupportLifecycleFrag: Unresolved error while connecting client. Stopping auto-manage.
I/GoogleFit: Google Play services connection failed. Cause: ConnectionResult{statusCode=CANCELED, resolution=null, message=null}

Here is my code:

private void buildFitnessClient() {
        if (mClient == null && checkPermissions()){
            mClient = new GoogleApiClient.Builder(this)
                    .addApi(Fitness.SENSORS_API)
                    .addScope(Fitness.SCOPE_LOCATION_READ)
                    .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
                       @Override
                        public void onConnected(Bundle bundle) {
                            Log.i(TAG, "Connected!!!");
                            findFitnessDataSources();
                        }

                       @Override
                        public void onConnectionSuspended(int i) {
                            if (i == GoogleApiClient.ConnectionCallbacks.CAUSE_NETWORK_LOST) {
                                Log.i(TAG, "Connection lost.  Cause: Network Lost.");
                            } else if (i
                                    == GoogleApiClient.ConnectionCallbacks.CAUSE_SERVICE_DISCONNECTED) {
                                Log.i(TAG,
                                        "Connection lost.  Reason: Service Disconnected");
                            } else {
                                Log.i(TAG,
                                        "Error number " + i);
                            }
                        }
                    }).enableAutoManage(this, new GoogleApiClient.OnConnectionFailedListener(){

                       @Override
                        public void onConnectionFailed(ConnectionResult connectionResult) {
                            Log.i(TAG, "Google Play services connection failed. Cause: " +
                                    connectionResult.toString());
                            Toast.makeText(getApplicationContext(), "Exception while connecting to Google Play services: " +
                                    connectionResult.getErrorMessage(), Toast.LENGTH_LONG);
                        }
                    }).build();
        }
    }


Can any one see any possible issues?


Update:
It seems that I get errors, but how I can view them ?
http://s9.postimg.org/7ue55jsgv/Screen_Shot_2016_02_05_at_10_36_56.png

Update 2:
I was able to dig deeper into issue. It seems that I can't get token for some reason:
http://s14.postimg.org/44468edg1/Screen_Shot_2016_02_05_at_10_58_10.png


Any ideas what is causing it?
1
Eduards Denisjonoks's profile photoSayooj Valsan's profile photo
4 comments
 
+Eduards Denisjonoks​ that did work. The issue was the package name got changed in the process and was not updated in the Dev console. Thank you for pointing to the right direction.
Add a comment...
 
Hi,

I have a couple of questions:

1. Can I get dataSources from stored data (from HistoryApi)?

2. If I have data stored from different dataSources (source1, source2 and source3) how can I filter out aggregated data from source3 and get just data from source1 and source2 (eg. source1 is googleFit(device), source2 is mapMyWalk and source3 is mySource(some other hardware))?
I don't want data from mySource to be included in aggregate buckets.

Something like this:

DataReadRequest.Builder builder = new DataReadRequest.Builder()
.aggregate(source1, DataType.AGGREGATE_STEP_COUNT_DELTA)
.aggregate(source2, DataType.AGGREGATE_STEP_COUNT_DELTA)
.bucketByTime(1, TimeUnit.MINUTES)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();

Thanks for your help in advance!
1
Add a comment...

Jason Burke

Bug Reports  - 
 
 
At the bottom of the Settings page, there are configurations for "Active mode." I've got mine set to give audio announcements every mile and to show above the lock screen.

Neither of those things work for me. Google fit doesn't show over the lock screen, and I've never gotten an audio announcement.

What I'm wondering is whether those things are working for other people?

I'm running Google Fit on a Moto X 2nd Gen phone.
2
Jason Burke's profile photoMark Stronge's profile photo
10 comments
 
+Gouri Joshi that's what I've been trying to say LOL I just thought people knew to tap on the big red plus.
Add a comment...