triggerActivities property
Configures a comma-separated list of motion-activities which are allow to trigger location-tracking.
⚠️ Warning: Requires that the user grant your app the "Motion/Health" permission.
These are the comma-delimited list of activity-names returned by the ActivityRecognition API which will trigger a state-change from stationary to moving. By default, the plugin will trigger on any of the moving-states:
| Activity Name |
|---|
in_vehicle |
on_bicycle |
on_foot |
running |
walking |
If you wish, you can configure the plugin to only engage the moving state for vehicles-only by providing just "in_vehicle", for example.
Example
import 'package:flutter_background_geolocation/flutter_background_geolocation.dart' as bg;
// Only trigger tracking for vehicles
await bg.BackgroundGeolocation.ready(bg.Config(
activity: bg.ActivityConfig(
triggerActivities: 'in_vehicle',
),
));
// Only trigger tracking for on_foot, walking and running
await bg.BackgroundGeolocation.ready(bg.Config(
activity: bg.ActivityConfig(
triggerActivities: 'on_foot,walking,running',
),
));
Implementation
final String? triggerActivities;