stopAfterElapsedMinutes property
Automatically BackgroundGeolocation.stop tracking after x minutes.
The plugin can optionally automatically BackgroundGeolocation.stop after some number of minutes elapses after the BackgroundGeolocation.start method was called.
import 'package:flutter_background_geolocation/flutter_background_geolocation.dart' as bg;
// Configure the plugin to automatically stop after 30 minutes.
await bg.BackgroundGeolocation.ready(bg.Config(
geolocation: bg.GeoConfig(
stopAfterElapsedMinutes: 30,
),
)).then((bg.State state) {
// Start tracking; the plugin will automatically stop after 30 minutes.
bg.BackgroundGeolocation.start();
});
Implementation
final int? stopAfterElapsedMinutes;