'Retrieve Blood Glucose Data using Google Fit HistoryAPI
I'm trying to retrieve Blood Glucose Data using the Google Fit HistoryAPI. I used the HistoryAPI example for getting the step count (https://github.com/googlearchive/android-fit/tree/master/BasicHistoryApi) and tried to modify it so that I get blood glucose data instead of the step count.
I changed the fitnessOptions to:
FitnessOptions fitnessOptions =
FitnessOptions.builder()
.addDataType(DataType.TYPE_STEP_COUNT_DELTA, FitnessOptions.ACCESS_WRITE)
.addDataType(DataType.AGGREGATE_STEP_COUNT_DELTA, FitnessOptions.ACCESS_WRITE)
.addDataType(TYPE_BLOOD_GLUCOSE, FitnessOptions.ACCESS_READ)
.addDataType(AGGREGATE_BLOOD_GLUCOSE_SUMMARY, FitnessOptions.ACCESS_READ)
.build();
and the readRequest looks like this:
DataReadRequest readRequest =
new DataReadRequest.Builder()
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.aggregate(TYPE_BLOOD_GLUCOSE, AGGREGATE_BLOOD_GLUCOSE_SUMMARY)
.bucketByTime(1, TimeUnit.DAYS)
.build();
The step counter example works fine but I always get an empty dataset without any data points when I try to retrieve blood glucose data. What could be the problem here?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
