EddyVerbruggen / HealthKit

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

Cordova HealthKit Plugin

NPM version Downloads Twitter Follow

Supported functions

See the example for how to use these functions.

Resources

Tips

Installation

Using the Cordova CLI?

cordova plugin add com.telerik.plugins.healthkit --variable HEALTH_READ_PERMISSION='App needs read access' --variable HEALTH_WRITE_PERMISSION='App needs write access'

HEALTH_READ_PERMISSION and HEALTH_WRITE_PERMISSION are shown when your app asks for access to data in HealthKit.

Using PhoneGap Build?

<plugin name="com.telerik.plugins.healthkit" source="npm" />

<!-- Read access -->
<config-file platform="ios" parent="NSHealthShareUsageDescription">
  <string>App needs read access</string>
</config-file>
<!-- Write access -->
<config-file platform="ios" parent="NSHealthUpdateUsageDescription">
  <string>App needs write access</string>
</config-file>

Using PhoneGap Build - cli-7 or superior?

PhoneGap Build has recently migrated from the custom build process to the standard Cordova build process. If you are already running on the new builder, it is no longer necessary to add the variables differently, and the variables must be defined as in the Cordova case.

<platform name="ios">
    <plugin name="com.telerik.plugins.healthkit" spec="^0.5.5" >
        <variable name="HEALTH_READ_PERMISSION" value="App needs read access" />
        <variable name="HEALTH_WRITE_PERMISSION" value="App needs write access" />
    </plugin>        
</platform>

Need Clinical Records Functionality (FHIR)?

If you would like to read clinical record (FHIR) data from the HealthKit store you can use the fork of this plugin here. Please see https://github.com/EddyVerbruggen/HealthKit/issues/113 for why this was functionality was removed from this plugin.