Samsung Health SDK - Android:读取理想时间的总燃烧卡路里

Samsung Health SDK - Android : Read total burnt calories for ideal time

我想 fetch/read 来自健康应用程序的数据。使用 HealthDataResolver.AggregateRequest 读取不同的数据值,例如总步数和距离。

下面是工作代码,我得到了 startTime 和 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();

现在的问题是我想获得理想的距离和消耗的卡路里time/activity。没有任何运动或步数燃烧的卡路里。查看应用程序的this screenshot,所需数据已加框并带有下划线。

所以要读取理想的距离和燃烧的卡路里time/activity,如何构造 AggregateRequest ?或者有计算吗?

我们将不胜感激。

来自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.

您可以使用其中之一 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)

您可以查看keisan这个网站,根据您的需要计算。