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.
From wiki
The metabolic equivalent of task (MET) is the objective measure of the ratio of the rate at which a person expends energy, relative to the mass of that person, while performing some specific physical activity compared to a reference, set by convention at 3.5 ml of oxygen per kilogram per minute, which is roughly equivalent to the energy expended when sitting quietly.
You can use one of these Metabolic Rate Formulas
The Revised Harris-Benedict Equation
Men BMR = 88.362 + (13.397 x weight in kg) + (4.799 x height in cm) - (5.677 x age in years)
Women BMR = 447.593 + (9.247 x weight in kg) + (3.098 x height in cm) - (4.330 x age in years)