carp_apps_package 0.1.5+1 copy "carp_apps_package: ^0.1.5+1" to clipboard
carp_apps_package: ^0.1.5+1 copied to clipboard

outdated

Apps package for the CARP Mobile Sensing framework (Android only).

example/lib/main.dart

import 'package:carp_apps_package/apps.dart';
import 'package:carp_mobile_sensing/carp_mobile_sensing.dart';

/// This is a very simple example of how this sampling package is used with CARP Mobile Sensing (CAMS).
/// NOTE, however, that the code below will not run.
/// See the documentation on how to use CAMS: https://github.com/cph-cachet/carp.sensing-flutter/wiki
void main() async {
  SamplingPackageRegistry.register(AppsSamplingPackage());

  Study study = Study("1234", "bardram", name: "bardram study");

  // creating a task collecting step counts and blood pressure data for the last two days
  study.addTriggerTask(
    ImmediateTrigger(), // a simple trigger that starts immediately
    Task(name: 'Step and blood pressure')
      ..addMeasure(
        Measure(
          MeasureType(NameSpace.CARP, AppsSamplingPackage.APP_USAGE),
          name: 'App usage',
        ),
      )
      ..addMeasure(
          Measure( MeasureType(NameSpace.CARP, AppsSamplingPackage.APPS),
            name: 'Blood Pressure Diastolic'),
      )
  );

  // Create a Study Controller that can manage this study, initialize it, and start it.
  StudyController controller = StudyController(study);

  // await initialization before starting
  await controller.initialize();
  controller.resume();

  // listening on all data events from the study
  controller.events.forEach(print);
}