简体   繁体   English

检测是否已手动输入HealthKit活动

[英]Detect if HealthKit activity has been entered manually

You can check which app inserted the activity via the 'source' activity. 您可以通过“来源”活动检查哪个应用插入了活动。 Is there a way to know if the activity has been entered manually or if the activity was an activity that was recorded live from sensors and added to HealthKit? 有没有办法知道活动是否已手动输入,或者活动是否是从传感器实时录制并添加到HealthKit的活动?

Apple only provides two properties for the HKSource class, the bundleIdentifier and the name of the source, as of iOS8.x HKSource ,Apple仅为HKSource类提供两个属性,即bundleIdentifier和源name

The bundle identifier of the entry if made manually will be com.apple.Health , which is the bundle identifier of the Health app. 如果手动创建的条目的包标识符将是com.apple.Health ,它是Health应用程序的包标识符。 Notice the capital H . 注意大写字母H. When you pull your data just ignore the data which has a bundle identifier of com.apple.Health. 提取数据时,只需忽略包含com.apple.Health标识符的数据。

That way you will be only considering activities which are not manual. 这样你就只会考虑非手动的活动。

Hope this helps. 希望这可以帮助。 Let me know if you need more information. 如果您需要更多信息,请与我们联系。

You can also refer the link here for another way to do this: Ignore manual entries from Apple Health app as Data Source 您还可以参考此处的链接以获取另一种方法: 忽略Apple Health应用程序中的手动条目作为数据源

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

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