Closed YaLazreq closed 1 month ago
Plugin version: 4.15.5
Platform: iOS and Android
OS version: MacOS Sequoia 15.0
Device manufacturer / model: Apple Macbook Pro m3
Flutter info (flutter doctor):
flutter doctor
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 16.0) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.1) [✓] VS Code (version 1.94.1) [✓] Connected device (4 available) [✓] Network resources • No issues found!
Plugin config:
void _setupBackgroundGeolocation() { bg.BackgroundGeolocation.onLocation(_onLocation, _onLocationError); bg.BackgroundGeolocation.onMotionChange(_onMotionChange); bg.BackgroundGeolocation.onActivityChange(_onActivityChange); // bg.BackgroundGeolocation.onHeartbeat(_onHeartbeat); bg.BackgroundGeolocation.onGeofence(_onGeofence); bg.BackgroundGeolocation.ready(bg.Config( // reset: true, debug: true, logLevel: bg.Config.LOG_LEVEL_VERBOSE, desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH, distanceFilter: 10.0, disableElasticity: false, 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: true, )).then((bg.State state) { print("[ready] ${state.toMap()}"); bg.BackgroundGeolocation.start().then((bg.State state) { print('[start] success $state'); setState(() { _enabled = state.enabled; _isMoving = state.isMoving!; }); }); }).catchError((error) { print('[ready] ERROR: $error'); });
I try to use AppLifecycleState on my app. I see the lib using it, how can i use the lib appLifeCycle state ?
D/TSLocationManager( 8371): [c.t.l.l.LifecycleManager onPause] ☯️ onPause D/TSBackgroundFetch( 8371): ☯️ onPause D/TSLocationManager( 8371): [c.t.l.l.LifecycleManager onStop] ☯️ onStop D/TSBackgroundFetch( 8371): ☯️ onStop
Nothing, i don't know how to use the LifecycleManager of the flutter_background_geolocation lib, nothing in the doc
When the user terminate the app, i need to update he's status on my db.
how can i use the lib appLifeCycle state ?
You can’t. It uses the same api for this as Flutter’s AppLifecycleState. Try implementing a headlessTask. See api docs Config.enableHeadless.
Your Environment
Plugin version: 4.15.5
Platform: iOS and Android
OS version: MacOS Sequoia 15.0
Device manufacturer / model: Apple Macbook Pro m3
Flutter info (
flutter doctor
):Plugin config:
Expected Behavior
I try to use AppLifecycleState on my app. I see the lib using it, how can i use the lib appLifeCycle state ?
Actual Behavior
Nothing, i don't know how to use the LifecycleManager of the flutter_background_geolocation lib, nothing in the doc
Steps to Reproduce
Context
When the user terminate the app, i need to update he's status on my db.
Debug logs
Logs
``` D/TSLocationManager( 8371): [c.t.l.l.LifecycleManager onPause] ☯️ onPause D/TSBackgroundFetch( 8371): ☯️ onPause D/TSLocationManager( 8371): [c.t.l.l.LifecycleManager onStop] ☯️ onStop D/TSBackgroundFetch( 8371): ☯️ onStop```