carp_context_package 0.6.3 copy "carp_context_package: ^0.6.3" to clipboard
carp_context_package: ^0.6.3 copied to clipboard

outdated

CARP context sampling package. Samples location, activity, weather, and geofence.

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
  • geofence

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: 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>NSLocationAlwaysAndWhenInUseUsageDescription</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>

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.

  SamplingPackageRegistry.register(ContextSamplingPackage());
10
likes
0
points
455
downloads

Publisher

verified publishercachet.dk

Weekly Downloads

CARP context sampling package. Samples location, activity, weather, and geofence.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

activity_recognition_alt, air_quality, carp_mobile_sensing, flutter, json_annotation, location, openmhealth_schemas, weather

More

Packages that depend on carp_context_package