I'm using the plugin for a very simple walk-tracking feature. And it all works correctly when the user is moving. But when it stopped for a longer time, the plugin goes in geofence mode correctly, which I want to bypass entirely.
I want to avoid going into that state entirely.
Ideally the app just keeps tracking without any geofence even if the user had not moved. Can I achieve it somehow?
This is my config:
void _configureBackgroundGeolocation() async {
//Configure the plugin
bg.BackgroundGeolocation.ready(bg.Config(
reset:
false, // <-- lets the Settings screen drive the config rather than re-applying each boot.
// Convenience option to automatically configure the SDK to post to Transistor Demo server.
// transistorAuthorizationToken: token,
// Logging & Debug
debug: false,
logLevel: bg.Config.LOG_LEVEL_VERBOSE,
// Geolocation options
desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
distanceFilter: Navigation.distanceFilter,
speedJumpFilter: Navigation.speedJumpFilter,
// Activity recognition options
stopTimeout: 3,
backgroundPermissionRationale: bg.PermissionRationale(
title:
"Allow {applicationName} to access this device's location even when the app is closed or not in use.",
message:
"This app collects location data to enable recording your trips to work and calculate distance-travelled.",
positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
negativeAction: 'Cancel'),
stopOnTerminate: true,
startOnBoot: false,
enableHeadless: false,
foregroundService: true,
heartbeatInterval: Navigation.heartbeatInterval))
.then((bg.State state) async {
print('[ready] ${state.toMap()}');
print('[didDeviceReboot] ${state.didDeviceReboot}');
if (state.schedule!.isNotEmpty) {
bg.BackgroundGeolocation.startSchedule();
}
}).catchError((error) {
print('[ready] ERROR: $error');
});
}
I'm using the plugin for a very simple walk-tracking feature. And it all works correctly when the user is moving. But when it stopped for a longer time, the plugin goes in geofence mode correctly, which I want to bypass entirely. I want to avoid going into that state entirely. Ideally the app just keeps tracking without any geofence even if the user had not moved. Can I achieve it somehow?
This is my config:
void _configureBackgroundGeolocation() async { //Configure the plugin bg.BackgroundGeolocation.ready(bg.Config( reset: false, // <-- lets the Settings screen drive the config rather than re-applying each boot. // Convenience option to automatically configure the SDK to post to Transistor Demo server. // transistorAuthorizationToken: token, // Logging & Debug debug: false, logLevel: bg.Config.LOG_LEVEL_VERBOSE, // Geolocation options desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH, distanceFilter: Navigation.distanceFilter, speedJumpFilter: Navigation.speedJumpFilter, // Activity recognition options stopTimeout: 3, backgroundPermissionRationale: bg.PermissionRationale( title: "Allow {applicationName} to access this device's location even when the app is closed or not in use.", message: "This app collects location data to enable recording your trips to work and calculate distance-travelled.", positiveAction: 'Change to "{backgroundPermissionOptionLabel}"', negativeAction: 'Cancel'), stopOnTerminate: true, startOnBoot: false, enableHeadless: false, foregroundService: true, heartbeatInterval: Navigation.heartbeatInterval)) .then((bg.State state) async { print('[ready] ${state.toMap()}'); print('[didDeviceReboot] ${state.didDeviceReboot}'); if (state.schedule!.isNotEmpty) { bg.BackgroundGeolocation.startSchedule(); } }).catchError((error) { print('[ready] ERROR: $error'); }); }