reliable_background_location 0.1.0
reliable_background_location: ^0.1.0 copied to clipboard
Background location tracking on Android that keeps recording through Doze, screen-off, battery saver and process death, and reports refused foreground service starts instead of failing silently.
0.1.0 #
Initial release. Android only.
start()returns aStartResultthat distinguishes the reasons Android refuses a foreground service start, rather than throwing or failing silently.requestPermissions()prompts in the order Android accepts — foreground location and notifications first, then background location as a separate request, since from Android 11 the two cannot share one prompt.PermissionStateseparatescanStartfromisComplete, so a caller can tell "cannot track" from "will track until the app leaves the screen".- Native buffering of fixes recorded while no Dart isolate is alive, drained
through
drainBuffered(). sessionStatepersisted natively and returned inStartResult.recoveredSessionStateafter the OS restarts a killed service.- Partial wakelock held for the session, so Doze does not suspend the isolate while the foreground service is up.
- Helpers for battery saver state and the vendor auto-start settings screens.
Verified on a physical device: live tracking, screen-off continuity, recovery
of fixes buffered across process death, and START_STICKY service restart.