carp_apps_package 0.40.1 carp_apps_package: ^0.40.1 copied to clipboard
Apps sampling package for the CARP Mobile Sensing framework (Android only).
import 'package:carp_core/carp_core.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 {
// register this sampling package before using its measures
SamplingPackageRegistry().register(AppsSamplingPackage());
// create a study protocol
StudyProtocol protocol = StudyProtocol(
ownerId: 'owner@dtu.dk',
name: 'Apps Sensing Example',
);
// define which devices are used for data collection
// in this case, its only this smartphone
Smartphone phone = Smartphone();
protocol.addMasterDevice(phone);
// add an automatic task that collects the list of installed apps
// and a log of app usage activity
protocol.addTriggeredTask(
ImmediateTrigger(),
BackgroundTask()
..addMeasure(Measure(type: AppsSamplingPackage.APPS))
..addMeasure(Measure(type: AppsSamplingPackage.APP_USAGE)),
phone);
}