transistorsoft / flutter_background_geolocation

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

How to use the flutter_background_geolocation AppLifecycleState ? #1366

Closed YaLazreq closed 1 month ago

YaLazreq commented 1 month ago

Your Environment

Expected Behavior

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

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```
christocracy commented 1 month ago

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.