I want to fetch/read data from health app. Using HealthDataResolver.AggregateRequest
to read different data value like total stepCounts and distance.
Below is the working code and I am getting total step count between startTime and endTime.
HealthDataResolver.AggregateRequest request = new HealthDataResolver.AggregateRequest.Builder()
.setDataType(HealthConstants.StepCount.HEALTH_DATA_TYPE)
.addFunction(HealthDataResolver.AggregateRequest.AggregateFunction.SUM, HealthConstants.StepCount.COUNT, ALIAS_TOTAL_COUNT)
.setTimeGroup(HealthDataResolver.AggregateRequest.TimeGroupUnit.DAILY, 1, HealthConstants.StepCount.START_TIME,
HealthConstants.StepCount.TIME_OFFSET, ALIAS_BINNING_TIME)
.setLocalTimeRange(HealthConstants.StepCount.START_TIME, HealthConstants.StepCount.TIME_OFFSET,
startTime, endTime)
.setSort(ALIAS_BINNING_TIME, HealthDataResolver.SortOrder.ASC)
.build();
Now the question is I want to get distance and calories burnt by ideal time/activity. Not any calories burnt by any Exercise or Steps. See this screenshot of app, the desired data is boxed and underlined.
So to read distance and calories burnt by ideal time/activity, how to construct AggregateRequest ? OR Is there any calculations?
Help will be appreciated.