carp_context_package 0.5.0

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
  • activity
  • weather

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.

dependencies:
  flutter:
    sdk: flutter
  carp_mobile_sensing: ^0.5.0
  carp_context_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.ACCESS_FINE_LOCATION" />
   <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
   <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions"/>

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

Note that 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:

<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>NSMotionUsageDescription</key>
<string>Detects activity.</string>
<key>UIBackgroundModes</key>
  <array>
  <string>fetch</string>
  <string>location</string>
</array>

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.

  SamplingPackageRegistry.register(ContextSamplingPackage());

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:


dependencies:
  carp_context_package: ^0.5.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_context_package/activity_datum.dart';
import 'package:carp_context_package/activity_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_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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
56
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

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/context_package.dart.

Run flutter format to format lib/context_package.dart.

Fix additional 8 files with analysis or formatting issues.

Additional issues in the following files:

  • 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/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/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
activity_recognition_alt ^0.1.7 0.1.7
carp_mobile_sensing ^0.5.0 0.5.1
flutter 0.0.0
json_annotation ^2.0.0 2.4.0
location ^2.3.5 2.3.5
openmhealth_schemas ^0.1.3 0.1.3
weather ^0.9.2 0.9.4
Transitive dependencies
analyzer 0.37.0
app_usage 0.1.0
archive 2.0.10
args 1.5.2
async 2.3.0
battery 0.3.0+5
boolean_selector 1.0.5
charcode 1.1.2
collection 1.14.11
connectivity 0.4.3+6
convert 2.1.1
crypto 2.0.6
csslib 0.16.1
device_apps 1.0.8
device_info 0.4.0+2
file_utils 0.1.1
fixnum 0.10.9
flutter_blue 0.5.0 0.6.0+1
front_end 0.1.20
glob 1.1.7
globbing 0.2.0 0.3.0
html 0.14.0+2
http 0.12.0+2
http_multi_server 2.1.0
http_parser 3.1.3
io 0.3.3
js 0.6.1+1
kernel 0.3.20
light 0.1.1
matcher 0.12.5
meta 1.1.6 1.1.7
mime 0.9.6+3
multi_server_socket 1.0.2
node_preamble 1.4.4
package_config 1.0.5
package_resolver 1.0.10
path 1.6.2
path_provider 0.5.0+1 1.1.2
pedantic 1.8.0+1
pedometer 0.0.5
pool 1.4.0
protobuf 0.10.8 0.13.15
pub_semver 1.4.2
screen_state 0.1.1
sensors 0.4.0+1
shelf 0.7.5
shelf_packages_handler 1.0.4
shelf_static 0.2.8
shelf_web_socket 0.2.3
sky_engine 0.0.99
source_map_stack_trace 1.1.5
source_maps 0.10.8
source_span 1.5.5
stack_trace 1.9.3
stats 0.2.0+2
stream_channel 2.0.0
stream_transform 0.0.19
string_scanner 1.0.4
system_info 0.1.1
term_glyph 1.1.0
test_api 0.2.6
test_core 0.2.7
typed_data 1.1.6
uuid 1.0.3 2.0.2
vector_math 2.0.8
vm_service_lib 3.22.2
watcher 0.9.7+12
web_socket_channel 1.0.14
yaml 2.1.16
Dev dependencies
build_runner any
flutter_test
json_serializable ^2.0.0
test any 1.6.5

Admin