carp_communication_package 0.8.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

CARP Communication Sampling Package #

pub package

This library contains a sampling package for communication sampling to work with the carp_mobile_sensing package. This packages supports sampling of the following Measure types:

  • phone_log
  • telephony
  • text-message-log
  • text-message
  • calendar

See the wiki for further documentation, particularly on available measure types and sampling schemas. There is privacy protection of text messages and phone numbers in the default Privacy Schema.

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_mobile_sensing: ^0.5.0
  carp_communication_package: ^0.5.0
  ...

Android Integration #

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

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="<your_package_name>"
    xmlns:tools="http://schemas.android.com/tools">

   ...
   
   <!-- The following permissions are used for CARP Mobile Sensing -->
   <uses-permission android:name="android.permission.CALL_PHONE"/>
   <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
   <uses-permission android:name="android.permission.READ_PHONE_NUMBERS"/>
   <uses-permission android:name="android.permission.READ_SMS"/>
   <uses-permission android:name="android.permission.READ_CALENDAR"/>
    <!-- Even though we only want to READ the calendar, for some unknown reason we also need to add the WRITE permission. -->
   <uses-permission android:name="android.permission.WRITE_CALENDAR"/>

</manifest>

NOTE: Version 0.5.0 is migrated to AndroidX. This should not result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library. See Flutter AndroidX compatibility

iOS Integration #

Add this permission in the Info.plist file located in ios/Runner:

<key>NSCalendarsUsageDescription</key>
<string>INSERT_REASON_HERE</string>

Using it #

To use this package, import it into your app together with the carp_mobile_sensing package:

import 'package:carp_mobile_sensing/carp_mobile_sensing.dart';
import 'package:carp_comunication_package/context.dart';

Before creating a study and running it, register this package in the SamplingPackageRegistry.

  SamplingPackageRegistry.register(CommunicationSamplingPackage());

0.8.0 #

  • upgrade to carp_mobile_sensing v. 0.8.x
  • upgrading the PhoneLogProbe
    • removed the PhoneLogMeasure measure
    • using the new MarkedMeasure for the
  • using Duration to specify the CalendarMeasure

0.7.0 #

  • upgrade to carp_mobile_sensing v. 0.7.0

0.6.6 #

  • upgrade to carp_mobile_sensing v. 0.6.6

0.6.5 #

  • upgrade to carp_mobile_sensing v. 0.6.5

0.6.1 #

  • allignment with carp_mobile_sensing v. 0.6.1.
  • extensive testing on iOS

0.6.0 #

  • update to carp_mobile_sensing version 0.6.0

0.5.0 #

  • calendar measure, probe, and datum added incl. default privacy protection
  • phone_log measure redesigned as a periodic measure
  • text_message_log measure redesigned as a periodic measure
  • Relying on carp_mobile_sensing ^0.5.0 which is migrated to AndroidX.
    • This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.
    • See Flutter AndroidX compatibility

0.3.4 #

  • upgrade to json_serializable v.2
  • privacy schema support for hashing text messages and phone numbers

0.3.3 #

  • update to carp_mobile_sensing version 0.3.10

0.3.2 #

  • Documentation

0.3.1 #

  • Documentation

0.3.0 #

  • Initial release compatible with carp_mobile_sensing version 0.3.*

example/lib/main.dart

import 'package:carp_mobile_sensing/carp_mobile_sensing.dart';
import 'package:carp_communication_package/communication.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(CommunicationSamplingPackage());

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

  // adding all measure from the common schema to one one trigger and one task
  study.addTriggerTask(
      ImmediateTrigger(), // a simple trigger that starts immediately
      AutomaticTask()
        ..measures = SamplingSchema.common().getMeasureList(
          namespace: NameSpace.CARP,
          types: [
            CommunicationSamplingPackage.TELEPHONY,
            CommunicationSamplingPackage.PHONE_LOG,
            CommunicationSamplingPackage.TEXT_MESSAGE,
            CommunicationSamplingPackage.TEXT_MESSAGE_LOG,
            CommunicationSamplingPackage.CALENDAR,
          ],
        ));

  // 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);
}

Use this package as a library

1. Depend on it

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


dependencies:
  carp_communication_package: ^0.8.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:carp_communication_package/communication.dart';
import 'package:carp_communication_package/communication.g.dart';
import 'package:carp_communication_package/communication_datum.dart';
import 'package:carp_communication_package/communication_measures.dart';
import 'package:carp_communication_package/communication_package.dart';
import 'package:carp_communication_package/communication_privacy.dart';
import 'package:carp_communication_package/communication_probes.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
47
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Jul 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform android

Because of import path [package:carp_communication_package/communication.dart, package:carp_mobile_sensing/carp_mobile_sensing.dart, package:carp_mobile_sensing/data_managers/data_managers.dart, package:path_provider/path_provider.dart, package:path_provider_linux/path_provider_linux.dart] that declares support for platforms: linux

Package does not support Flutter platform ios

Because of import path [package:carp_communication_package/communication.dart, package:carp_mobile_sensing/carp_mobile_sensing.dart, package:carp_mobile_sensing/sampling_packages/apps/apps.dart, package:device_apps/device_apps.dart] that declares support for platforms: android

Package does not support Flutter platform linux

Because of import path [package:carp_communication_package/communication.dart, package:permission_handler/permission_handler.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because of import path [package:carp_communication_package/communication.dart, package:permission_handler/permission_handler.dart] that declares support for platforms: android, ios

Package does not support Flutter platform web

Because of import path [package:carp_communication_package/communication.dart, package:permission_handler/permission_handler.dart] that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because of import path [package:carp_communication_package/communication.dart, package:permission_handler/permission_handler.dart] that declares support for platforms: android, ios

Package not compatible with SDK dart

because of import path [carp_communication_package] that is in a package requiring null.

Health suggestions

Fix lib/communication_privacy.dart. (-3.45 points)

Analysis of lib/communication_privacy.dart reported 7 hints, including:

line 13 col 13: Name non-constant identifiers using lowerCamelCase.

line 22 col 7: Name non-constant identifiers using lowerCamelCase.

line 30 col 7: Name non-constant identifiers using lowerCamelCase.

line 39 col 7: Name non-constant identifiers using lowerCamelCase.

line 50 col 11: Name non-constant identifiers using lowerCamelCase.

Format lib/communication_datum.dart.

Run flutter format to format lib/communication_datum.dart.

Format lib/communication_measures.dart.

Run flutter format to format lib/communication_measures.dart.

Format lib/communication_package.dart.

Run flutter format to format lib/communication_package.dart.

Format lib/communication_probes.dart.

Run flutter format to format lib/communication_probes.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
call_log ^2.0.0 2.1.0
carp_mobile_sensing ^0.8.0 0.8.0
crypto ^2.1.0 2.1.5
device_calendar ^3.0.0 3.1.0 3.2.0-dev.11640
flutter 0.0.0
json_annotation ^3.0.0 3.0.1
sms ^0.2.4 0.2.4
Transitive dependencies
app_usage 0.1.0
archive 2.0.13
args 1.6.0
async 2.4.1
battery 1.0.1
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
device_apps 1.0.10
device_info 0.4.2+4
file 5.2.1
file_utils 0.1.4
flutter_web_plugins 0.0.0
globbing 0.3.1
intl 0.16.1
light 0.1.1
meta 1.1.8
package_info 0.4.1
path 1.7.0
path_provider 1.6.11
path_provider_linux 0.0.1+2
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
pedometer 1.2.0
permission_handler 5.0.1+1
permission_handler_platform_interface 2.0.1
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
screen_state 0.1.1
sensors 0.4.2+2
shared_preferences 0.5.7+3
shared_preferences_macos 0.0.1+10
shared_preferences_platform_interface 1.0.4
shared_preferences_web 0.1.2+7
sky_engine 0.0.99
stats 1.0.0
system_info 0.1.3
typed_data 1.1.6 1.2.0
uuid 2.2.0
vector_math 2.0.8
xdg_directories 0.1.0
Dev dependencies
build_runner any
flutter_test
json_serializable ^3.0.0
test any