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:


A HealthMeasure can be configured to collect a specific HealthDataType.

A HealthDataType can be:

  • STEPS,
  • ...

See the HealthDataType documentation for a complete list.

See the wiki for further documentation, particularly on available measure types. See the CARP Mobile Sensing App for an example of how to build a mobile sensing app in Flutter.

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.


To use this package, add the following to you pubspc.yaml file. Note that this package only works together with carp_mobile_sensing.

    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/ file with the following lines:


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:

<string>We will sync your data with the Apple Health app to give you better insights</string>
<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.


When defining a study protocol with this health measure, it would look like this:

  // collect weight every day at 23:00
          type: RecurrentType.daily, time: TimeOfDay(hour: 23, minute: 00)),
        ..addMeasure(Measure(type: HealthSamplingPackage.HEALTH)
          ..overrideSamplingConfiguration = HealthSamplingConfiguration(
              healthDataTypes: [HealthDataType.WEIGHT])),

See the example.dart file for a full example of how to set up a CAMS study protocol for this sampling package.


A CAMS sampling package for collecting health information from Apple Health or Google Fit. Is using the health plugin. Can be configured to collect the different HealthDataType.