简体   繁体   English

我可以从Healthkit获得Mindful Minutes的合计值吗?

[英]Can I get aggregated value of Mindful Minutes from Healthkit?

For an HKQuantityType like Steps, the HKStatisticsCollectionQuery can be used to get the aggregated value of Steps since HealthKit itself handles it. 对于HKQuantityType像台阶, HKStatisticsCollectionQuery可以用来获取步骤的合计值,因为HealthKit本身处理它。 But Mindful Minutes is an HKCategoryType and from what I know HKStatisticsCollectionQuery doesn't support this type. 但是HKCategoryType Minutes是HKCategoryType ,据我所知, HKStatisticsCollectionQuery不支持此类型。

So how do I fetch the aggregated value that is displayed on the Health app's dashboard when "Mindfulness" is tapped? 因此,当点击“正念”时,如何获取健康应用程序的仪表板上显示的汇总值? Is there a way? 有办法吗? Or should I remove the duplicate time ranges myself? 还是我应该自己删除重复的时间范围?

You need to use an HKSampleQuery and account for overlapping samples. 您需要使用HKSampleQuery和帐户来重叠样本。 There is no HealthKit API that computes aggregate values for HKCategorySampleS. 没有HealthKit API可以计算HKCategorySampleS的合计值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM