Reputation: 91
I am trying to send history of one week Calories burnt data using History_API. My code is like this -
// Connection Establishment
DataReadRequest readRequest = new DataReadRequest.Builder()
.aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build();
Fitness.HistoryApi.readData(mClient, readRequest).setResultCallback(new ResultCallback<DataReadResult>() {
}
I am getting this error "GoogleApiClient is not configured to use Fitness.API required for this call." Any idea why?
Upvotes: 1
Views: 1288
Reputation: 4296
You need to add the Fitness.SENSORS_API when you initialize the mClient.
The code will look something like this:
mClient = new GoogleApiClient.Builder(this)
.addApi(Fitness.SENSORS_API)
.build();
You can get more info here: https://developers.google.com/android/reference/com/google/android/gms/fitness/Fitness
Upvotes: 3