carp_mobile_sensing 0.2.6

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 82

CARP Mobile Sensing Framework in Flutter

This library contains the software architecture for the CARP sensing framework implemented in Flutter. Supports cross-platform (iOS and Android) sensing.

pub package

For Flutter plugins for other CARP products, see CARP Mobile Sensing in Flutter.

Usage

To use this plugin, add carp_mobile_sensing as a dependency in your pubspec.yaml file.

This plugin relies on json_serialization: ^1.0.0 which again rely on Dart 2.1. This mean that (at the time of writing) you should use the dev channel in Flutter. This can be set using the following Flutter command:

flutter channel dev

Note that there are two issues with Android to consider:

  • Issue #1 - make sure your app's android build.gradle has a minSdkVersion 19 (instead of 16 ).
  • Issue #2 - update the he file build.gradle in flutter_blue and change the JDK parameters to 26 (instead of 27).

Android Integration

Add the following to your apps manifest.xml file located in android/app/src/main:

<manifest
   ...
   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
   <uses-permission android:name="android.permission.RECORD_AUDIO"/>
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
   <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />

   <application
      ...
      <!-- service for using the Android activity recognition API -->
      <service android:name="at.resiverbindet.activityrecognition.activity.ActivityRecognizedService" />
    </application>
</manifest>

iOS Integration

Add this permission in Info.plist:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Uses the location API to record location.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Uses the location API to record location.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Uses the microphone to record ambient noise in the phone's environment.</string>
<key>NSMotionUsageDescription</key>
<string>Detects activity.</string>
<key>UIBackgroundModes</key>
  <array>
  <string>audio</string>
  <string>bluetooth-central</string>
  <string>bluetooth-peripheral</string>
  <string>external-accessory</string>
  <string>fetch</string>
  <string>location</string>
</array>

Documentation

The Dart API doc describes the different libraries and classes.

The wiki contains detailed documentation on the CARP Mobile Sensing Framework, including the domain model, its built-in probes, and how to extend it.

Below is a very simple / minimum example.

Example

// Import package
import 'package:carp_mobile_sensing/carp_mobile_sensing.dart';

... {
  // Instantiate a new study
  Study study = new Study("1234", "bardram", name: "Test study #1");

  // Setting the data endpoint to print to the console
  study.dataEndPoint = new DataEndPoint(DataEndPointType.PRINT);

  // Create a task to hold measures
  Task task = new Task("Simple Task");

  // Create a battery and location measures and add them to the task
  // Both are listening on events from changes from battery and location
  task.addMeasure(new BatteryMeasure(ProbeRegistry.BATTERY_MEASURE));
  task.addMeasure(new LocationMeasure(ProbeRegistry.LOCATION_MEASURE));

  // Create an executor that can execute this study, initialize it, and start it.
  StudyExecutor executor = new StudyExecutor(study);
  executor.initialize();
  executor.start();
}

There is a very simple example app which shows how a study can be created with different tasks and measures. This app just prints the sensing data to a console screen on the phone.

Auto generation of files

Files depending on JSON serialization can be generated using build_runner, by running the following command in the root of your Flutter project:

flutter packages pub run build_runner build --delete-conflicting-outputs

Features and bugs

Please read about existing issues and file new feature requests and bug reports at the issue tracker.

License

This software is copyright (c) 2018 Copenhagen Center for Health Technology (CACHET) at the Technical University of Denmark (DTU). This software is made available 'as-is' in a MIT license.

0.2.6

  • fixed small bug in weater probe.

0.2.5

  • small bug fixes in connectivity datum model (to work w. `carp_firebase_backend).
  • weather probe added.

0.2.4

  • error in light probe fixed.
  • noise probe added.
  • using the carp_core domain model

0.2.3

  • fixed error in readme file.

0.2.2

  • phone_log probe added
  • audio probe added
  • activity probe added
  • improvement to readme file on manifest.xml and Info.plist.

0.2.1

  • re-organization of github location and outline
  • improvements to FileDataManager to avoid race conditions
  • improved API documentation

0.2.0

  • refactor of organization of classes into libraries
  • complete API documentation

0.1.1

  • small improvements incl. documentation

0.1.0

  • removal of all remote backend code to separate packages

0.0.1

  • Initial version by Jakob E. Bardram
  • Transferring the old implementation to this carp.sensing-flutter framework
  • General refactor and clean-up

example/README.md

CARP Mobile Sensing Example

Demonstrates how to use the carp_mobile_sensing plugin.

Getting Started

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  carp_mobile_sensing: ^0.2.6

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:carp_mobile_sensing/carp_mobile_sensing.dart';
  
Version Uploaded Documentation Archive
0.2.6 Dec 5, 2018 Go to the documentation of carp_mobile_sensing 0.2.6 Download carp_mobile_sensing 0.2.6 archive
0.2.5 Dec 5, 2018 Go to the documentation of carp_mobile_sensing 0.2.5 Download carp_mobile_sensing 0.2.5 archive
0.2.4 Nov 15, 2018 Go to the documentation of carp_mobile_sensing 0.2.4 Download carp_mobile_sensing 0.2.4 archive
0.2.3 Nov 5, 2018 Go to the documentation of carp_mobile_sensing 0.2.3 Download carp_mobile_sensing 0.2.3 archive
0.2.2 Nov 5, 2018 Go to the documentation of carp_mobile_sensing 0.2.2 Download carp_mobile_sensing 0.2.2 archive
0.2.1 Oct 21, 2018 Go to the documentation of carp_mobile_sensing 0.2.1 Download carp_mobile_sensing 0.2.1 archive
0.2.0 Oct 14, 2018 Go to the documentation of carp_mobile_sensing 0.2.0 Download carp_mobile_sensing 0.2.0 archive
0.1.1 Oct 13, 2018 Go to the documentation of carp_mobile_sensing 0.1.1 Download carp_mobile_sensing 0.1.1 archive
0.1.0 Oct 9, 2018 Go to the documentation of carp_mobile_sensing 0.1.0 Download carp_mobile_sensing 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
64
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
82
Learn more about scoring.

We analyzed this package on Dec 17, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7
  • Flutter: 1.0.0

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/probes/apps/apps.dart. (-0.50 points)

Analysis of lib/probes/apps/apps.dart reported 1 hint:

line 10 col 8: Duplicate import.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
activity_recognition ^0.1.3 0.1.3
app_usage ^0.0.2 0.0.2
archive ^2.0.4 2.0.5
battery ^0.2.3 0.2.3
call_log ^1.0.2 1.0.5
carp_core ^0.1.0 0.1.2
connectivity ^0.3.2 0.3.2
device_apps ^1.0.0 1.0.3
device_info ^0.2.1 0.2.1 0.3.0
flutter 0.0.0
flutter_blue ^0.4.1 0.4.1
flutter_sound ^1.1.5 1.2.1
json_annotation ^1.0.0 1.2.0 2.0.0
light ^0.0.3 0.0.4
location ^1.4.1 1.4.1
noise_meter ^0.0.3 0.0.3
path_provider ^0.4.1 0.4.1
pedometer ^0.0.3 0.0.5
screen_state ^0.0.1 0.0.1
sensors ^0.3.4 0.3.5
sms ^0.2.4 0.2.4
stats ^0.2.0 0.2.0+2
system_info ^0.1.0 0.1.0
uuid ^1.0.0 1.0.3 2.0.0-rc1
weather ^0.1.01 0.1.03
Transitive dependencies
args 1.5.1
async 2.0.8
charcode 1.1.2
collection 1.14.11
convert 2.0.2
crypto 2.0.6
file_utils 0.1.1
fixnum 0.10.9
globbing 0.2.0
http 0.12.0
http_parser 3.1.3
meta 1.1.6
path 1.6.2
protobuf 0.9.1 0.10.5
sky_engine 0.0.99
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
build_runner any
flutter_test
json_serializable ^1.0.0