Geting smaller buckets from Google Fit does not work

I have been trying to get GoogleFit data with buckets 15 minutes in the last 2 weeks. But for some reason, the call to HistoryApi never ends, even if I wait a few minutes. When using 1 hour buckets, it returns pretty quickly. Are there any restrictions that I just did not see?

My plan would be to get 15 minute buckets in the last year or so, but if even 2 weeks of work it would be a problem ...

What I still have: I installed my GoogleApi client as follows:

  mClient = new GoogleApiClient.Builder(mContext) .addApi(Fitness.SENSORS_API) .addApi(Fitness.HISTORY_API) .addScope(new Scope(FITNESS_ACTIVITY_READ)) .addConnectionCallbacks( new GoogleApiClient.ConnectionCallbacks() { @Override public void onConnected(Bundle bundle) { fetchHistoryData(); } @Override public void onConnectionSuspended(int i) { // Here I'll handle that case } } ) .enableAutoManage(mContext, 0, new GoogleApiClient.OnConnectionFailedListener() { @Override public void onConnectionFailed(ConnectionResult result) { //Here I'll handle that case } }) .build(); 

And then I try to extract the data as follows:

  final DataReadRequest readRequest = new DataReadRequest.Builder() .aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA) .aggregate(DataType.TYPE_CALORIES_EXPENDED, DataType.AGGREGATE_CALORIES_EXPENDED) .bucketByTime(1, TimeUnit.HOURS) .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS) .build(); Fitness.HistoryApi.readData(mClient, readRequest).setResultCallback(new ResultCallback<DataReadResult>() { @Override public void onResult(@NonNull DataReadResult dataReadResult) { handleGoogleFitData(dataReadResult); } }); 

which works fine, but when I go ahead and change the bucket time to .bucketByTime(15, TimeUnit.MINUTES) , my onResult will never be called. I also noticed the same thing, having 1 hour intervals and returning for 1 year.

Is this a limitation of Google Fit? At least I did not find any documentation about such a limit ...

I also sometimes get a request callback quickly, sometimes it just never returns. Any ideas on this?

+7
android google-fit google-fit-sdk
source share

No one has answered this question yet.

See related questions:

2735
Stop EditText from getting focus when starting Activity
1169
Is there a way to get the source code from an APK file?
nine
GoogleFit distinguishes data between different devices
4
Getting a list of actions (movements) from google fit api
2
Why doesn't Google Fit match the right app?
one
GoogleFit API sometimes doesn't work
0
java.lang.IllegalStateException: You must specify a valid backing strategy when requesting aggregation
0
GoogleFit sample not working
0
TextSwitcher not updated
0
BloodPresure intermediate points from GoogleFit

All Articles