简体   繁体   English

HealthKit数据重复性问题

[英]HealthKit data duplicity concerns

I have an app which reads data from Strava, Runkeeper and couple of other health apps. 我有一个可从Strava,Runkeeper和其他几个健康应用程序读取数据的应用程序。 Now I am planning to integrate HealthKit in my app and read data from there as well. 现在,我计划将HealthKit集成到我的应用程序中,并从中读取数据。

My concern is data duplicity. 我担心的是数据重复性。 ie say Strava sharing same data to my app and Healthkit, and then my app updating same data from HealthKit. 即说Strava将相同的数据共享给我的应用程序和Healthkit,然后我的应用程序从HealthKit中更新相同的数据。

Not sure if this is allowed due to privacy concerns or not, Is there any way my app can know what all apps share data with HealthKit, preferably date range and type of data as well. 不知道是否出于隐私方面的考虑允许这样做,我的应用程序是否可以通过任何方式知道所有应用程序与HealthKit共享的数据,最好还有日期范围和数据类型。

OR 要么

Do I need to build the comparison logic in my app itself to detect duplicate data based on date and actual data? 我是否需要在应用程序本身中构建比较逻辑以根据日期和实际数据检测重复数据?

The best way to do this with the HealthKit API is to simply not process data that comes from providers that your app can already integrate with. 使用HealthKit API进行此操作的最佳方法是不处理来自您的应用程序已经可以与之集成的提供商的数据。 Every HKObject has an HKSource property, and that HKSource will give you the bundle identifier of the application that created it. 每个HKObject都有一个HKSource属性,该HKSource将为您提供创建它的应用程序的捆绑标识符。 You can use this to create a blacklist of sources to reject from HealthKit. 您可以使用它创建要从HealthKit拒绝的来源黑名单。

Yes you can do this with health kit. 是的,您可以使用保健套件来做到这一点。

The HealthKit store provides a number of methods for accessing its data. HealthKit存储提供了许多访问其数据的方法。

For more details go through https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HealthKit_Framework/ .. 有关更多详细信息,请访问https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HealthKit_Framework/ .。

let me know if you get stuck somewhere.. :) 让我知道你是否被卡在某处.. :)

HealthKit framework is a centralized store for health data among various applications with in the iPhone device. HealthKit框架是iPhone设备中各种应用程序之间健康数据的集中存储。 So, all the health apps can share health data with HealthKit store. 因此,所有健康应用程序都可以与HealthKit商店共享健康数据。

For your case, there may be possibly 2 solutions available. 对于您的情况,可能有2种解决方案可用。

  1. Simply stop updating health data from all other health apps like Strava, RunKeeper, etc., and read same information from Apple's HEALTH app to avoid duplicate records. 只需停止从Strava,RunKeeper等所有其他健康应用程序中更新健康数据,并从Apple的HEALTH应用程序中读取相同的信息即可避免重复记录。

  2. Read health data from all other health apps which you would prefer and omit the health data fetching from Apple's HEALTH app, which was entered from Strava, RunKeeper, etc., Sample to get the health data based on source is https://stackoverflow.com/a/29346592/1295573 从您喜欢的所有其他健康应用程序中读取健康数据,并省略从Apple的HEALTH应用程序中获取的健康数据,该应用程序是从Strava,RunKeeper等输入的。基于源获取健康数据的示例为https:// stackoverflow。 COM / A /一百二十九万五千五百七十三分之二千九百三十四万六千五百九十二

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

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