EddyVerbruggen / HealthKit

Cordova plugin for the iOS HealthKit framework
MIT License
167 stars 215 forks source link

Adding ability to add other measurements (like BAC)? #12

Open felixekman opened 9 years ago

felixekman commented 9 years ago

Is there a possibility to add support for the ability to add other measurements (like BAC)?

EddyVerbruggen commented 9 years ago

Hi, can you tell me what you think that should look like? I mean, how would you like to use it so it suits your needs.

felixekman commented 9 years ago

Looking at the HealthKit Framework from Apple it could be nice to integrate the healthkit constants references. It could be useful let say if you have a drink app or a mixing app and want to enter the users estimated BAC after drinking a night. The data would fall under the Results Identifiers and for the BAC it would be declared like this (Swift) let HKQuantityTypeIdentifierBloodAlcoholContent: NSString! or (Obj-C) NSString * const HKQuantityTypeIdentifierBloodAlcoholContent. To quote Apple:

HKQuantityTypeIdentifierBloodAlcoholContent A quantity sample type that measures the user’s blood alcohol content.

These samples use percent units (described in HKUnit Class Reference) and measure discrete values (described in HKStatisticsQuery Class Reference).

Available in iOS 8.0 and later.

In your plugin it would be nice to be able to pass the data by issuing saveBAC and passing the percentage value as Apple sugests. Then for reading the saved value readBAC.

https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HealthKit_Constants/index.html#//apple_ref/doc/uid/TP40014710