Sam Leach
Sam Leach

Reputation: 12956

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?

Upvotes: 4

Views: 1912

Answers (1)

Gurtej Singh
Gurtej Singh

Reputation: 3234

Apple only provides two properties for the HKSource class, the bundleIdentifier and the name of the source, as of iOS8.x

The bundle identifier of the entry if made manually will be com.apple.Health, which is the bundle identifier of the Health app. Notice the capital H. When you pull your data just ignore the data which has a bundle identifier of 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

Upvotes: 7

Related Questions