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:

  • dk.cachet.carp.phone_log - the phone log.
  • dk.cachet.carp.text-message-log - the text (sms) message log.
  • dk.cachet.carp.text-message - incoming text (sms) messages.
  • dk.cachet.carp.calendar - all calendar entries.

See the wiki for further documentation, particularly on available measure types and sampling schemas. Note that collection of phone and text message data is only supported on Android.

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_core: ^latest
  carp_mobile_sensing: ^latest
  carp_communication_package: ^latest
  ...

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.RECEIVE_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"/>


  <application>
	  ...
	  ...
    <!-- Registration of broadcast reciever to listen to SMS messages 
         when the app is in the background -->
	  <receiver android:name="com.shounakmulay.telephony.sms.IncomingSmsReceiver"
		   android:permission="android.permission.BROADCAST_SMS" android:exported="true">
		  <intent-filter>
        <action android:name="android.provider.Telephony.SMS_RECEIVED"/>
      </intent-filter>
    </receiver>

   </application>
</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_core/carp_core.dart';
import 'package:carp_mobile_sensing/carp_mobile_sensing.dart';
import 'package:carp_communication_package/communication.dart';

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

  SamplingPackageRegistry().register(CommunicationSamplingPackage());

Libraries

communication
A library for collecting communication data, from