transistorsoft / flutter_background_geolocation

Sophisticated, battery-conscious background-geolocation & geofencing with motion-detection
https://www.transistorsoft.com/shop/products/flutter-background-geolocation
Other
651 stars 242 forks source link

Running geolocation without geofence #1322

Closed csongorkeller closed 3 months ago

csongorkeller commented 4 months ago

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'); }); }

christocracy commented 4 months ago

See api docs Config.stopTimeout. You are free to use a really large number.

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 3 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.