- How do I get the same step count as the Google Fit app?
- Values for step/distance/active time/calories do not match those of Fit app
- How do I query for available third-party or other data sources?
- Do I need to install the Fit app to use the APIs?
How do I get the same step count as the Google Fit app?
The Fit app uses a specific data source for steps. It adds the following functionality on top of the default merged steps stream:
- Steps recorded during biking, driving, and some other non-moving activities are removed.
- When an activity that involves steps (such as walking or running) doesn't have a reasonable number of steps associated with it, steps for the activity are estimated.
You can access the "estimated" steps stream as shown here:
Via the REST API:
Via the Android API:
new DataSource.Builder() .setAppPackageName(“com.google.android.gms”) .setDataType(DataType.TYPE_STEP_COUNT_DELTA) .setType(DataSource.TYPE_DERIVED) .setStreamName("estimated_steps") .build();
Note that even when using the right data source, your step count may still be different from that of the Google Fit app. This could be due to one of the following reasons:
- On Wear, the Fit MicroApp when connected will display step counts queried on the phone and transferred over via the Wearable APIs. Other MicroApps accessing local-only data will only get watch steps. We are working on making this easier for developers.
- Sometimes the step calculation code for the Google Fit app is updated with bug fixes before we are able to release the fixes to developers (which requires a Google Play Services release). We are also working on making it possible for developers to access fixes at the same time.
Values for step/distance/active time/calories do not match those of Fit app
Because of how Google Fit updates are released, it may be possible that the Google Fit app has a more recent version of our data analysis code than Google Play Services, which is released less often.
Our backends, however, always have the most recent version of the data, and everything gets processed there eventually and should match up after a couple of cloud syncs. Let us know if that’s not the case.
We’re trying to make this situation better by making it possible for apps to request that we process a cloud sync instantly so that everything is in sync, and also by making it so that syncs happen automatically when significant data is entered or changes.
This could also be caused by not reading the proper data sources. To match the value of Google Fit, you should be reading data like this:
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.AGGREGATE_STEP_COUNT_DELTA) .aggregate(DataType.TYPE_DISTANCE_DELTA, DataType.AGGREGATE_DISTANCE_DELTA) .aggregate(DataType.TYPE_CALORIES_EXPENDED, DataType.AGGREGATE_CALORIES_EXPENDED) .aggregate(DataType.TYPE_ACTIVITY_SEGMENT, DataType.AGGREGATE_ACTIVITY_SUMMARY) .bucketByTime(1, TimeUnit.DAYS) .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS) .build();
How do I query for available third-party or other data sources?
Today, this is only available via the REST API; this data is not yet available via the Android API.
Do I need to install the Fit app to use the APIs?
The Fit app does not need to be installed in order for your app to successfully implement the Fit platform's APIs.