carp_context_package 0.6.4

  • Readme
  • Changelog
  • Installing
  • 70

CARP Context Sampling Package #

pub package

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

  • location
  • geolocation
  • activity
  • weather
  • geofence
  • air_quality

See the wiki for further documentation, particularly on available measure types and sampling schemas.

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.

    sdk: flutter
  carp_mobile_sensing: ^0.6.0
  carp_context_package: ^0.6.0

Android Integration #

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

<manifest xmlns:android=""

   <!-- The following permissions are used for CARP Mobile Sensing -->
   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
   <uses-permission android:name="" />
   <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions"/>

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

NOTE: Version 0.5.0 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

iOS Integration #

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

<string>Uses the location API to record location.</string>
<string>Uses the location API to record location.</string>
<string>Uses the location API to record location.</string>
<string>Detects activity.</string>

NOTE: Activity Recognition does not work on iOS (issue #18)

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_context_package/context.dart';

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


0.6.4 #

  • change of location provider to the geolocator plugin.
  • introduction of a geolocation measure type for listening to location events.
  • adjustment of the LocationMeasure to hold configuration for specifying various options.

0.6.3 #

  • support for air_quality

0.6.1 #

  • Changed the location probe to a periodic probe which can be configured to sample location data on a specific frequency.
  • allignment with carp_mobile_sensing v. 0.6.1.
  • testing on iOS reveals that activity recognition does not work on iOS

0.6.0 #

  • update to carp_mobile_sensing version 0.6.0
  • Weather measure is no longer periodic but 'one-off', i.e. at DatumProbe. Use the new Trigger model in carp_mobile_sensing v.0.6.0 to achieve periodic sampling of weather information.

0.5.0 BREAKING #

  • Upgraded to use carp_mobile_sensing version 0.5.0
    • Breaking change. This version has been migrated from the deprecated Android Support Library to AndroidX. This should not result in any functional changes, but it requires any Android app using this plugin to also migrate if using the original support library.
    • See Flutter AndroidX compatibility

0.3.6 #

  • small update to domain model

0.3.5 #

  • update to json_serialization v.2
  • added support for geofence measure

0.3.4 #

  • update to carp_mobile_sensing version 0.3.10

0.3.3 #

  • Documentation

0.3.2 #

  • Update to carp_mobile_sensing v. 0.3.7
  • Using the data types in the package (activity, weather, location)

0.3.1 #

  • Documentation

0.3.0 #

  • Initial release compatible with carp_mobile_sensing version 0.3.*

Use this package as a library

1. Depend on it

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

  carp_context_package: ^0.6.4

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_context_package/activity_datum.dart';
import 'package:carp_context_package/activity_probe.dart';
import 'package:carp_context_package/air_quality_datum.dart';
import 'package:carp_context_package/air_quality_measure.dart';
import 'package:carp_context_package/air_quality_probe.dart';
import 'package:carp_context_package/context.dart';
import 'package:carp_context_package/context.g.dart';
import 'package:carp_context_package/context_package.dart';
import 'package:carp_context_package/context_transformers.dart';
import 'package:carp_context_package/geofence_datum.dart';
import 'package:carp_context_package/geofence_measure.dart';
import 'package:carp_context_package/geofence_probe.dart';
import 'package:carp_context_package/location_datum.dart';
import 'package:carp_context_package/location_measure.dart';
import 'package:carp_context_package/location_probe.dart';
import 'package:carp_context_package/weather_datum.dart';
import 'package:carp_context_package/weather_measure.dart';
import 'package:carp_context_package/weather_probe.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Format lib/activity_datum.dart.

Run flutter format to format lib/activity_datum.dart.

Format lib/activity_probe.dart.

Run flutter format to format lib/activity_probe.dart.

Format lib/air_quality_datum.dart.

Run flutter format to format lib/air_quality_datum.dart.

Fix additional 13 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/air_quality_measure.dart (Run flutter format to format lib/air_quality_measure.dart.)
  • lib/air_quality_probe.dart (Run flutter format to format lib/air_quality_probe.dart.)
  • lib/context_package.dart (Run flutter format to format lib/context_package.dart.)
  • lib/context_transformers.dart (Run flutter format to format lib/context_transformers.dart.)
  • lib/geofence_datum.dart (Run flutter format to format lib/geofence_datum.dart.)
  • lib/geofence_measure.dart (Run flutter format to format lib/geofence_measure.dart.)
  • lib/geofence_probe.dart (Run flutter format to format lib/geofence_probe.dart.)
  • lib/location_datum.dart (Run flutter format to format lib/location_datum.dart.)
  • lib/location_measure.dart (Run flutter format to format lib/location_measure.dart.)
  • lib/location_probe.dart (Run flutter format to format lib/location_probe.dart.)
  • lib/weather_datum.dart (Run flutter format to format lib/weather_datum.dart.)
  • lib/weather_measure.dart (Run flutter format to format lib/weather_measure.dart.)
  • lib/weather_probe.dart (Run flutter format to format lib/weather_probe.dart.)

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and carp_context_package.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
activity_recognition_alt ^0.1.7 0.1.7
air_quality ^1.0.0 1.1.0
carp_mobile_sensing ^0.6.2 0.6.4
flutter 0.0.0
geolocator ^5.1.5 5.3.1
json_annotation ^3.0.0 3.0.1
openmhealth_schemas ^0.1.4 0.1.4+1
weather ^0.9.5 0.9.6
Transitive dependencies
_fe_analyzer_shared 2.1.0
analyzer 0.39.6
app_usage 0.1.0
archive 2.0.13
args 1.6.0
async 2.4.1
battery 0.3.1+9
boolean_selector 2.0.0
charcode 1.1.3
collection 1.14.11 1.14.12
convert 2.1.1
coverage 0.13.9
crypto 2.1.4
csslib 0.16.1
device_apps 1.0.9
device_info 0.4.2+1
equatable 1.1.1
file_utils 0.1.4
glob 1.2.0
globbing 0.3.0
google_api_availability 2.0.4
html 0.14.0+3
http 0.12.0+4
http_multi_server 2.2.0
http_parser 3.1.4
io 0.3.4
js 0.6.1+1
light 0.1.1
location 2.5.4 3.0.2
location_permissions 2.0.5
logging 0.11.4
matcher 0.12.6
meta 1.1.8
mime 0.9.6+3
multi_server_socket 1.0.2
node_interop 1.0.3
node_io 1.0.1+2
node_preamble 1.4.8
package_config 1.9.3
path 1.6.4
path_provider 1.6.5
path_provider_macos 0.0.4
path_provider_platform_interface 1.0.1
pedantic 1.9.0
pedometer 1.0.0
permission_handler 4.4.0+hotfix.4 5.0.0+hotfix.3
permission_handler_platform_interface 1.0.0 2.0.0
platform 2.2.1
plugin_platform_interface 1.0.2
pool 1.4.0
pub_semver 1.4.4
screen_state 0.1.1
sensors 0.4.1+10
shelf 0.7.5
shelf_packages_handler 2.0.0
shelf_static 0.2.8
shelf_web_socket 0.2.3
sky_engine 0.0.99
source_map_stack_trace 2.0.0
source_maps 0.10.9
source_span 1.7.0
stack_trace 1.9.3
stats 0.2.0+3 1.0.0
stream_channel 2.0.0
string_scanner 1.0.5
system_info 0.1.2
term_glyph 1.1.0
test_api 0.2.15
test_core 0.3.3
typed_data 1.1.6
uuid 2.0.4
vector_math 2.0.8
vm_service 4.0.0
watcher 0.9.7+14
web_socket_channel 1.1.0
webkit_inspection_protocol 0.5.0+1
yaml 2.2.0
Dev dependencies
build_runner any
json_serializable ^3.0.0
test any 1.14.2