carp_health_package 2.0.0 carp_health_package: ^2.0.0 copied to clipboard
CARP health sampling package. Samples health data from Apple Health or Google Fit.
CARP Health Sampling Package #
This library contains a sampling package for sampling health data from Apple Health and/or Google Fit to work with
the carp_mobile_sensing
framework.
This packages supports sampling of the following Measure
types:
dk.cachet.carp.health
A HealthMeasure
can be configured to collect a specific HealthDataType
.
A HealthDataType
can be:
- BODY_FAT_PERCENTAGE,
- HEIGHT,
- WEIGHT,
- BODY_MASS_INDEX,
- WAIST_CIRCUMFERENCE,
- STEPS,
- ...
See the HealthDataType
documentation for a complete list.
See the wiki for further documentation, particularly on available measure types and sampling schemas.
For Flutter plugins for other CARP products, see CARP Mobile Sensing in Flutter.
If you're interested in writing you own sampling packages for CARP, see the description on how to extend CARP on the wiki.
Installing #
To use this package, add the following to you pubspc.yaml
file. Note that
this package only works together with carp_mobile_sensing
.
dependencies:
flutter:
sdk: flutter
carp_core: ^latest
carp_mobile_sensing: ^latest
carp_health_package: ^latest
...
Android Integration #
This package uses AndroidX. See Flutter AndroidX compatibility
Replace the content of the android/gradle.properties
file with the following lines:
org.gradle.jvmargs=-Xmx1536M
android.enableJetifier=true
android.useAndroidX=true
Google Fit can be tricky to set up and it requires a separate app to be installed.
Please follow this guide to set up Google Fit.
Also - check out the documentation of the health
package.
iOS Integration #
Add this permission in the Info.plist
file located in ios/Runner
:
<key>NSHealthShareUsageDescription</key>
<string>We will sync your data with the Apple Health app to give you better insights</string>
<key>NSHealthUpdateUsageDescription</key>
<string>We will sync your data with the Apple Health app to give you better insights</string>
Using it #
To use this package, import it into your app together with the
carp_mobile_sensing
package:
import 'package:carp_core/carp_core.dart';
import 'package:carp_mobile_sensing/carp_mobile_sensing.dart';
import 'package:carp_health_package/health.dart';
Before creating a study and running it, register this package in the SamplingPackageRegistry.
SamplingPackageRegistry().register(HealthSamplingPackage());