我正在使用google javascript api 。为了获取卡路里,我正在使用下一个数据源:
- 派生:com.google.calories.expished:com.google.android.gms:from_activities 用于事件消耗的卡路里
- 派生:com.google.calories.expished:com.google.android.gms:from_bmr 是根据您的 BMR 燃烧的卡路里
我还可以使用数据源在一次调用中完成此操作 - 派生:com.google.calories.expished:com.google.android.gms:merge_calories_expished
我的通话如下所示:
gapi.client.fitness.users.dataSources.datasets.get({
userId: 'me',
dataSourceId: 'derived:com.google.calories.expended:com.google.android.gms:merge_calories_expended',
datasetId: '1465117200000000000-1465164000000000000'
}).execute(function (resp) { ......... });
但是返回的值与我在 Google Fit 应用程序(Android 或 Web)中的值完全不同。
我已经做了什么:
- 检查了所有包含“卡路里”一词的不同数据源(通过fitness.users.dataSources.datasets.get获取) - 与Fit应用程序不匹配。这些不匹配:
衍生:com.google.calories.bmr:com.google.android.gms:from_height&weight - 完全为空 派生:com.google.calories.bmr:com.google.android.gms:合并 - 完全空 派生:com.google.calories.expished:com.google.android.gms:from_activities - 返回,但与Fit应用程序不同 派生:com.google.calories.expished:com.google.android.gms:from_bmr - 返回,但与Fit应用程序不同 派生:com.google.calories.expished:com.google.android.gms:merge_calories_expished - from_activities + from_bmr 派生:com.google.calories.expished:com.google.android.gms:platform_calories_expished - 与merge_calories_expished相同
检查是否与日期相关,例如不同时区等。
检查了 stackoverflow
没有任何帮助:(
最佳答案
步数/距离/事件时间/卡路里的值与Google Fit - Frequently Asked Questions (FAQ)中给出的健身应用程序的值不匹配的可能原因是:
Because of how Google Fit updates are released, it may be possible that the Google Fit app has a more recent version of our data analysis code than Google Play Services, which is released less often.
Our backends, however, always have the most recent version of the data, and everything gets processed there eventually and should match up after a couple of cloud syncs.
请按照建议尝试让应用程序能够立即处理云同步,以便一切都同步,并且在输入或更改重要数据时自动进行同步。
我希望这对您有用。
关于javascript - 通过 Google Fit Api 检索的卡路里数与 Google Fit 官方应用程序中显示的卡路里数不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37642805/