Skip to main content

flutter_get_background_loc 0.13.4 copy "flutter_get_background_loc: ^0.13.4" to clipboard
flutter_get_background_loc: ^0.13.4 copied to clipboard

Accurate background location for Flutter with GNSS quality metrics, fake-GPS detection, adaptive Kalman filtering and offline-safe uploads.

0.13.4 #

Review fixes on top of 0.13.3 (the still probe, the 40 m skip-hop cap, mid-trip initialCoarse, Doze alarms, Doppler accuracy, and IMU-only wakes). Every change is configurable; defaults are documented in doc/configuration.md, doc/filtering.md and doc/motion-and-power.md.

  • Still probe never starts the service cold. When tracking should already be running (ConfigStore.wasRunning), ACTION_STILL_PROBE is delivered through a non-exported BroadcastReceiver and the service calls startForeground before it runs the probe. If the user has stopped tracking, the probe is ignored and the service is not started.
  • Skip-hop cap looks at pin age and motion evidence. filter.odometerSkipHopMaxPinAgeMs (default 30 s; 0 = motion evidence only; negative = 0.13.3, any hop above the 40 m cap is credited). A 50–100 m indoor snap after a long park is not counted; a mid-drive hop or a departure with IMU / activity still is.
  • A large hop is confirmed before it is odometered. filter.odometerConfirmLargeHop (default true) and filter.odometerLargeHopConfirmFixes (default 2). A hop above odometerSkipHopMaxMeters that passes the pin-age / motion-evidence check is held and added once the next 2 accepted fixes stay farther than max(cap, hop / 2) from the point before the hop; if a fix comes back near that point, the hop is dropped. Field check (30 Nov, 18:25 WIB): after a ~16 min GNSS gap the phone came back ~1.5 km from the parked pin, already driving at 6.6 m/s, and Competitor A independently credited ~1.45 km at the same moment. That is real distance driven during the gap: it is still credited (2 s later, same total 11,453.5 m in the replay). Without the guard, a single bad far fix with motion evidence (synthetic test: 1.5 km away after a 51 s gap) was credited and never undone; now it is not.
  • No mid-trip initialCoarse. filter.initialFixOnlyAtSessionStart (default true) allows a provisional coarse pin only at session start. After reset(keepOdometer: true) the first post-gap fix is not published as initialCoarse.
  • Exact Doze alarm when permitted. motion.stillProbeUseExactAlarm (default true) uses AlarmManager.setExactAndAllowWhileIdle when canScheduleExactAlarms() is true, and falls back to setAndAllowWhileIdle otherwise. setAndAllowWhileIdle is throttled under Doze to about one alarm every 9 minutes, which is why the inexact-only 0.13.3 probe could still be late. The SCHEDULE_EXACT_ALARM permission is already in the manifest.
  • More Doppler samples are usable. motion.gnssSpeedMaxAccuracyMps default is now 1.5 m/s (was 1.0; a field median was 1.2 m/s) and motion.gnssSpeedMinRatio (default 3.0, 0 disables) also accepts a sample when speed / speedAccuracy meets the ratio. The treadmill replay still shows 0 m of false odometer during the still phase.
  • The published point stays on the pin while locked. filter.pinPublishedWhileLocked (default true) keeps the published latitude/longitude on the lock pin until the release gate passes. A still segment no longer accumulates a path while the odometer stays at 0 (treadmill replay: 0.0 m published path during still). To avoid holding a real departure, three extra release paths fire even without Doppler or activity agreement: distance (pinDistanceReleaseMinFixes 3 fixes farther than max(25 m, 2 × accuracy)), max hold (pinMaxHoldMs, 20 s continuously far from the pin), and IMU-sustained (pinImuReleaseMinFixes 3 displaced fixes with IMU motion). A 276 s pinnedRelease stretch on the 29 Nov drive was a stop (GNSS within 6 m, speed 0, quiet IMU); counting only holds where the raw fix is more than 15 m from the pin, the longest hold on real driving is 1.0–2.0 s.
  • IMU-only wake after a long still. filter.imuOnlyWakeSecondSourceEnabled (default true), imuOnlyWakeMinStillMs (3 min), imuOnlyWakeConfirmMs (10 s): after a still of at least 3 minutes, an IMU-only wake does not publish a jump larger than the lock-release near radius until activity recognition or Doppler confirms. A late confirm is still accepted (safer than leaving a real departure pinned). A single usable Doppler sample at or above gnssMovingSpeedMps can confirm this wait (filter.imuOnlyWakeConfirmOnUsableDoppler, default true).
  • Odometer does not grow while Doppler says still. filter.odometerHoldWhenDopplerStill (default true) ignores a reported GNSS speed below gnssStillSpeedMps (even when speedAccuracy is poor). Stale vehicle activity is not enough on its own (odometerVehicleNeedsSpeedOrImu, default true); walking / on-foot / running is still counted. A min-net commit is also capped by the Doppler consistency limit so an 80 m parked snap cannot bypass it. On the 30 Nov field replay the long park (13:50–18:25) and the 18:41–18:56 stop go from 111 m / 118 m of odometer to 0 m.
  • A far, usable Doppler departure can publish on the first fix. filter.lockReleaseFarDopplerMeters (default 40 m, above typical indoor still-probe wander) with usable Doppler at or above lockReleaseFastSpeedMps wakes the lock and releases the pin in one sample. This cut the 30 Nov 18:25 departure from 12.4 s to 10.4 s (the first good raw fix). A 20 m / 2.3 m/s still-probe-like fix is intentionally not enough, so the treadmill still-path stays at 0 m.
  • Replay tool. dart run tool/replay_published.dart <fixes.csv> <events.csv> <out.csv> runs this version of the filter engine over a raw-fixes CSV (the same columns the package tests use). Optional environment overrides, merged onto the defaults: REPLAY_FILTER_JSON and REPLAY_MOTION_JSON (JSON objects). The tool ships with the package and does not include any private logs.

0.13.3 #

Field-run fixes from a 5 h 22 min outdoor run (13:34–18:56 WIB, both apps on one phone; 4.6 h parked indoors with every raw fix at 100–350 m accuracy). Every change is configurable; defaults are documented in doc/configuration.md.

  • The odometer no longer discards real distance. The release / wake skip-hop used to drop the whole hop from the pinned point to the first released fix. When the car started rolling while the lock still held (Doppler accuracy 2–7 m/s, so Doppler was unusable; activity reported still), that hop was real travel: the run lost 123.7 m + 96.3 m + 31.9 m of 5.8 km. Now a hop is discarded only when it is a residual snap: filter.odometerSkipHopMaxMeters (default 40 m). A larger hop is credited, and filter.lockReleaseSkipHopOnlyFromStill (default true) keeps a mid-drive IMU bump from arming the skip at all. 0 = always skip (0.13.2 behaviour).
  • The still/balanced silence probe survives Doze. It was a Handler.postDelayed only, which is deferred while the CPU sleeps: with a 120 s interval the run saw probes after 875 / 733 / 546 s and one 50-minute gap with no fix. It is now also armed with AlarmManager.setAndAllowWhileIdle (cancelled as soon as a fix arrives), so a parked phone keeps probing while the device dozes.
  • Tests. Unit tests for the hop cap (a 120 m hop is credited, an 18 m snap is skipped) and a replay of the field run (test/replay/run_20261130_133423_replay_test.dart, Eiffel offsets). Replay odometer 11877 m, no decrease across the 4.6 h still and the gaps (field 0.13.2: 10191 m).

Bench note: analyze_moving.py no longer scores held / pinned points as observations (they repeat the last known position) and reports the odometer against a moving reference, so a parked phone's multipath wander no longer makes a correct odometer look 15 % short. On this run the corrected figures are cross-track p95 4.1 m (was reported as a 1450 m maximum) and odometer 99.7 % of the moving reference.

0.13.2 #

Fixes from the outdoor drive replay (synthetic Eiffel Tower offsets of the 29 Nov run): the odometer no longer goes back to zero after a GNSS gap, the lock-release gate no longer holds real driving for tens of seconds, and the accuracy-spike gate no longer rejects a smooth accuracy rise for 24 s. Every change is configurable; defaults are documented in doc/configuration.md and doc/filtering.md.

  • Odometer across a gap (filter.odometerPreserveAcrossGap, default true). A reset() after a gap longer than resetAfterGapMs, and a mid-run updateConfig / setPreset, keep the distance already driven. The distance travelled during the gap is not guessed: the first post-gap fix is a skip-hop, so the odometer can lag reality but never over-counts. An explicit reset still zeroes it. Set false for the 0.13.1 behaviour.
  • Release gate from the previous raw fix (filter.lockReleaseFromPreviousRaw, default true; lockReleaseMaxAccuracyMeters 25 m, lockReleasePrevRawMaxAgeMs 5 s). The trail used to measure its first step from the pinned point, so after a long park the implied speed looked too low and the gate stayed closed until the car was ~90 m away. A stale or coarse reference is not used: the fix becomes a seed and the trail still needs lockReleaseMinFixes valid steps.
  • Vehicle fast release (filter.lockReleaseVehicleFastWake, default true; lockReleaseFastSpeedMps 3 m/s, lockReleaseFastMinFixes 2, lockReleaseFastSpeedAccFactor 2.0, lockReleaseFastMaxGapMs 3 s). Doppler speedAccuracy of 0 is treated as missing (many Android plugins send 0), and a missing one always needs the full streak. A soft veto holds the fast path only while the OS reports still, the IMU is quiet and Doppler is weak, so a real departure is not delayed. A coarse fix never opens the gate.
  • Spike agreement (filter.spikeAgreeFixes 3, spikeAgreeRatio 1.5, spikeAgreeMaxAccuracyMeters 25 m) and rejection cap (filter.spikeMaxConsecutiveRejects 8). A run of rejected fixes is accepted when it agrees in accuracy, moves consistently and stays within the absolute cap; a steadily rising accuracy that never agrees is accepted after the cap. 0 disables each option (0.13.1 behaviour).
  • Tests. Unit tests for the odometer gap, the release gate (fast path, speedAccuracy 0, soft veto, coarse guard, isVehicleActivity) and the spike gate, plus a replay of the drive (test/replay/run_20261129_160447_replay_test.dart) run twice: with the fixture's 0.5 m/s speedAccuracy and with a realistic 1.5 m/s.

Replay numbers (same fixes): 0.13.1-equivalent odometer 11.9 km and a release hold of hundreds of seconds; 0.13.2 odometer 16.2 km, longest hold 1.8 s, longest spike streak 2.

0.13.1 #

False-wake and false-distance fixes from a treadmill run (phone lying still on a running treadmill for 12 minutes: about 23 m of false odometer during the still phase in 0.13.0, 0 m in the new replay test). Every change is configurable; defaults are documented in doc/configuration.md, doc/filtering.md and doc/motion-and-power.md.

  • Doppler re-acquisition guard (motion.dopplerWakeIgnoreAfterAcquireMs, default 10 s; motion.dopplerAcquireGapMs, default 5 s). While locked, Doppler speed is ignored right after a GNSS (re-)acquisition such as a still-probe start, where 1–5 m/s transients were seen on a still phone.
  • Doppler wake needs corroboration (motion.stationaryDopplerWakeRequiresImu, default true; dopplerWakeImuMinRms 1.5 m/s²; dopplerWakeSustainedMs 20 s). While locked, Doppler alone wakes only with IMU RMS ≥ 1.5, a moving (or pending moving) activity, or 20 s of sustained Doppler motion, so a smooth low-IMU vehicle still wakes. Walking (IMU / AR) is unchanged.
  • Release gate on any wake (filter.wakeReleaseGateOnAnyWake, default true). The lock-release gate and the odometer skip-hop now apply to the first fix after any still-to-moving wake, even when that fix is rejected early by the stationary anchor (previously the gate could be bypassed and a ~25 m indoor snap odometered).
  • Odometer rules (all filter.*): odometerRequireMotionEvidence (true, window odometerMotionEvidenceWindowMs 15 s), odometerMinNetDisplacementMeters (8 m over odometerNetWindowMs 30 s; jitter around one spot is not counted, the odometer lags real travel by up to 8 m), odometerSkipReinitHop (true; cluster / speed-jump re-init hops are not counted) and odometerDopplerConsistency (true; a step is capped at (speed + speedAccuracy) × dt + accuracy when Doppler is usable).
  • wakeSource diagnostics. LocationFix.wakeSource, FilterResult.toMap()['wakeSource'] and MotionUpdate.wakeSource report what woke the device out of the lock (imu, doppler, activity, displacement, geofence); MotionTracker.wakeCount / lastWakeSource expose it to custom pipelines. The pinnedRelease detail names the wake source.
  • Behaviour change. A parked phone with low IMU and no activity recognition now needs 20 s of Doppler motion (or the 150 m geofence fallback) to leave still. Set stationaryDopplerWakeRequiresImu: false and dopplerWakeIgnoreAfterAcquireMs: 0 for the 0.13.0 wake behaviour, and the odometer options above to false / 0 for the 0.13.0 odometer.
  • Tests: synthetic Eiffel Tower replay of the treadmill run (run_20261129_141602), unit tests for the Doppler guards, the wake-armed gate, the odometer rules and the option round-trip.

0.13.0 #

Startup still / publish hold, a post-unlock release gate, a provisional initial location at Start, activity-watchdog backoff and still-probe backoff. Defaults are documented in doc/configuration.md, doc/motion-and-power.md and doc/filtering.md. The Android still probe stays on by default (stillProbeIntervalMs: 0 turns it off).

  • Start-in-still (motion.startupStillEnabled, default true). If the OS activity is still at or above startupStillMinConfidence (80) and IMU RMS has been at or below imuStillRms for startupStillMinImuWindows (2) windows, the motion state enters still and the pin applies immediately — it no longer waits for stopTimeoutMs (3 min) at the beginning of a session. Mid-drive starts are unchanged: a moving activity or IMU already above the motion threshold aborts this path. stopTimeoutMs still governs moving to still during a trip.
  • Startup publish hold (motion.startupHoldEnabled, default true, startupHoldTimeoutMs 15 s). Once IMU or activity has reported still, wandering GNSS is not published until still is confirmed, motion is corroborated, or the timeout elapses. At most the first good fix is published, then held. GNSS-only sessions (no IMU / activity still evidence) are unchanged.
  • Lock-release gate (filter.lockReleaseGateEnabled, default true). After a corroborated wake leaves still, the pin stays the published point until a new fix is within max(lockReleaseMinDistanceMeters, accuracy x lockReleaseAccuracyFactor) (15 m / 1.0) of the pin, or lockReleaseMinFixes (3) consecutive consistent walking-or-faster fixes (or Doppler at walking pace) agree. A geofence-confirmed departure is already corroborated and is not re-held. filter.odometerSkipLockReleaseHop (default true) does not add the hop from the pin to the first released fix to the odometer. New filter decisions: pinnedRelease, startupHold.
  • Activity watchdog default activityWatchdogMs is now 180 s (was 600 s), with activityWatchdogBackoffEnabled (default true, cap activityWatchdogMaxMs 15 min). If the last activity was still at high confidence, the first quiet stretch re-registers but does not arm the 150 m geofence fallback until activityDeadAfterSilentCycles (2) silent cycles.
  • Still-probe backoff (motion.stillProbeBackoffEnabled, default true). While locked and activity recognition is confidently still (and the IMU is still), the probe interval grows from stillProbeIntervalMs (120 s) up to stillProbeMaxIntervalMs (15 min). It resets on a corroborated wake, a moving activity, IMU motion, or a dead AR source. Probe status events include intervalMs and nextIntervalMs.
  • Initial coarse fix (filter.initialFixEnabled, default true). At Start, a first location may be published as soon as a fix at or below initialFixMaxAccuracyMeters (100 m) arrives, within initialFixTimeoutMs (30 s) of the first processed sample — even when it is too coarse for the normal quality gate (for example indoor hAcc 40–70 m, previously rejectedAccuracyNoHdop until a later probe). The fix is flagged FilterDecision.initialCoarse (quality = coarse) and is not added to the odometer. When a later fix is at or below initialFixRefineAccuracyMeters (30 m, the indoor coarse cap) the pin is moved to that better point as initialRefine; that hop is not odometered and does not trigger moving. Real AR / IMU / Doppler wakes still leave the lock through the release gate, and mid-drive starts are unchanged.
  • Tests: synthetic Eiffel Tower replay of indoor runs 20261129_110116 and 20261129_124637, plus startup still / hold, lock-release, AR-silence, probe-backoff, initial-coarse / refine, and coarse-then-walk / coarse-then-drive cases. Existing drive-after-parking, mid-drive start, walking release, and the 20261129_083900 replay stay green.

0.12.0 #

Stationary lock, implied-speed gate and a practical activity-recognition fix. Defaults are documented in doc/configuration.md, doc/motion-and-power.md and doc/filtering.md. The Android still probe stays on by default (stillProbeIntervalMs: 0 turns it off) but can no longer declare the device moving by itself.

  • Stationary lock (motion.stationaryLockEnabled, default true). While the motion state is still, the last published point is pinned and no new positions are emitted. GNSS displacement cannot leave still. The device leaves still only on:
    • a moving OS activity sustained for motion.motionTriggerDelayMs (default 3 s; a return to still before the delay cancels the wake);
    • sustained IMU RMS above the motion threshold (motion.stationaryWakeOnImu);
    • GNSS Doppler speed at walking pace for gnssSpeedMinFixes consecutive fixes, typically after a still-probe wake (motion.stationaryWakeOnDoppler);
    • a large-radius / geofence-style fallback (motion.stationaryRadiusMeters, default 150 m, stationaryRadiusMinFixes: 2) only when activity recognition is unavailable or silent. Implied speed from the pin must stay at walking pace or above and at or below filter.maxImpliedSpeedMps, so an indoor teleport cannot take this path.
  • Activity recognition (Android). The previous Transition API never fired if the phone was already still when tracking started, so activity stayed null and the watchdog kept re-registering. The plugin now also registers periodic Activity Recognition updates (motion.activityRecognitionIntervalMs, default 10 s) with explicit PendingIntents (FLAG_MUTABLE on Android 12+) and non-exported receivers, logs registration / permission / failures, and forwards a confidence (0–100) plus an activityStatus health event to Dart.
  • Implied-speed gate (filter.maxImpliedSpeedMps, default 60 m/s, impliedSpeedFromPublishedEnabled: true) against the last published or held point, including after an EKF re-init, with no accuracy margin. The raw-to-raw maxSpeedKmh gate is unchanged.
  • Odometer accuracy threshold (filter.odometerAccuracyThresholdMeters, default 20 m): published distance is only accumulated when the current fix is at least this accurate. LocationFix.odometer carries the running total.
  • Anchor trail exit is a strict fallback: the minimum outward step is accuracy-scaled (indoor.anchorTrailScaleMinStep, default true, factor 0.5), the path must be mostly straight and at least walking pace, and onDisplacement no longer leaves still. indoor.leavingAnchorMinFixes (default 3) must elapse before leavingAnchor is true. A still probe returns to low power unless a corroborated wake has already left still.
  • New diagnostic fields on LocationFix / FilterResult / MotionUpdate: imuRms (already present), activityConfidence, filterDecision, distanceToAnchor, leavingAnchor, odometer. New filter decision: pinned.
  • Tests: synthetic Eiffel Tower replay of an indoor still run (must stay pinned, false distance under 25 m, 70 / 186 m/s snaps rejected), creep and probe-burst cases, and drive-after-parking adapted so a real drive-away is still detected via AR / IMU / Doppler or the geofence fallback.

0.11.2 #

  • Docs: the README is now short (install, quick start, presets, links); the details moved to pages under doc/. Installation now uses flutter pub add flutter_get_background_loc.

0.11.1 #

  • No Material import in the package. package:flutter/material.dart is deprecated since Flutter 3.50 (pub.dev static analysis reported it as 3 issues). The built-in dialogs of LocationPermissionFlow, BackgroundLocationDisclosure and OemBackgroundHelper (OemGuideDialog) are now built with package:flutter/widgets.dart only, so they work the same in apps that use the legacy Material library, material_ui or cupertino_ui, and the package gains no new dependency. The look follows the calling context (text style from DefaultTextStyle, accent from DefaultSelectionStyle, which MaterialApp sets to the primary color). The existing builder / promptBuilder hooks still let an app show its own dialogs.
  • Tests and the example app use package:material_ui (dev dependency / example dependency only).
  • New test: the disclosure dialog works under a plain WidgetsApp without any Material ancestor.
  • GitHub Actions: CI (format, analyze, test, publish dry run) and tag-based publishing to pub.dev; README "Releasing" section and screenshots.
  • Docs: README badges (pub version, pub points, likes, platforms, CI, license, flutter_lints) and a demo video at the top (animated preview linking to doc/videos/demo.mp4 on GitHub).

0.11.0 #

Optional GNSS warm-up ("offline readiness"). Fully opt-in: nothing changes unless you call it.

  • FlutterGetBackgroundLoc.warmUpGnss({timeout, targetAccuracyM, requireNetwork, refreshAssistance}) runs a short GPS session and returns a GnssWarmUpResult (success, reason as GnssWarmUpFailure, timeToFirstFix, accuracyMeters, satellitesVisible / satellitesUsed, networkAvailable, assistance, fixesReceived, trackingWasRunning, ...). It never throws, needs no tracking service and does not interfere with a running one. A missing permission is a clear permissionDenied / preciseLocationRequired result; no dialog is shown.
  • Android: GPS_PROVIDER session + GnssStatus callback (satellites, OS time-to-first-fix). Optional best-effort assistance refresh via sendExtraCommand (force_time_injection, force_psds_injection, legacy force_xtra_injection), guarded by try/catch and by the normal permission ACCESS_LOCATION_EXTRA_COMMANDS, which the host app declares (the plugin manifest does not). delete_aiding_data is never sent. No third-party packages.
  • iOS: equivalent best effort with its own CLLocationManager (kCLLocationAccuracyBest) until the accuracy target or the timeout. iOS manages assistance data itself.
  • HealthStatus.lastGnssFixAt, gnssDataAge, isGnssDataStale([threshold = 4 h]): time of the last real GNSS fix (persisted; also updated by the warm-up) so apps can warn that data may be stale. Not part of warnings.
  • LocationConfig.warmUp (GnssWarmUpConfig): autoWarmUpBeforeStart (default false), timeout, targetAccuracyM, requireNetwork, refreshAssistance. With the flag on, startService warms up first and publishes a gnssWarmUp status event, then starts tracking regardless of the outcome.
  • Optional indoor score and state (IndoorConfig.robust, RobustIndoorConfig, default off): a 0..1 indoorScore and a tri-state IndoorState (indoor / outdoor / unknown) from the average accuracy (10 m -> 0, 40 m -> 1, weight 0.15), the mean C/N0 of all used satellites (32 -> 0, 22 dB-Hz -> 1, weight 0.65), the new Android cn0Top4 (mean of the four strongest used satellites, 35 -> 0, 20 -> 1, weight 0.10) and used satellites (8 -> 0, 0 -> 1, weight 0.10); a network fix floors the score at 0.7; iOS uses accuracy only with its own thresholds. Time-window hysteresis (enter indoor >= 0.7 for 12 s, exit < 0.4 for 4 s). The filter uses it as a weight only: indoor + still strengthens the anchor, indoor + moving inflates measurement noise and the jump-test margin; no fix is dropped because of it. New: LocationFix.cn0Top4 / indoorState, HealthStatus.indoorScore / indoorState, Heartbeat.indoorState, IndoorScorer.reset(). The legacy indoorLikely is unchanged while the detector is off.
  • Fix: a drive that starts after the phone was parked could be swallowed by the stationary anchor. With a smooth IMU (phone in a car holder) and no usable Doppler speedAccuracy, none of the anchor exits fired, so every fix was rejected as "anchored ... no motion exit", the motion state stayed still and the low-power (balanced, 30 s / 20 m) priority stayed on: the track became a straight line from the parking spot to wherever the anchor finally let go. New outward-trail exit (IndoorConfig.anchorTrailExitEnabled, default on): consecutive accurate fixes outside the exit radius that each move farther from the anchor (anchorTrailMinFixes 3, anchorTrailMinStepMeters 2 m, or two fixes with an outward step >= anchorTrailFarStepMeters 50 m, accuracy <= anchorTrailMaxAccuracyMeters 20 m) release the anchor and count as motion evidence (MotionTracker.onDisplacement), which also restores high-accuracy tracking. A static or jittering multipath cluster or a slow drift never qualifies. Moving-trail re-init: when the EKF rejects a steady, plausible, mostly straight run of fixes (for example after a 90-degree turn without Doppler), it restarts on the newest fix with the trail's speed and heading instead of holding until a static cluster forms. Counters: trailExitCount, trailReinitCount. Probe: while the anchored low-power priority is on, a fix outside the anchor's exit radius switches to high accuracy right away (LocationFilterEngine.leavingAnchor), so a departure is confirmed within seconds instead of one fix every 30 s; a multipath blip that returns inside goes back to low power.
  • Android silence probe in low power (MotionConfig.stillProbeIntervalMs = 120 s, stillProbeDurationMs = 20 s; 0 turns it off): when the balanced request has delivered no fix for the interval, the service registers a high-accuracy request for the duration (status event stillProbe), then returns to balanced unless the filter saw a departure. Fixes a field case where the fused provider delivered nothing at balanced priority for 17 minutes of driving, so low power never ended (no fixes meant no motion evidence) until the 15-minute provider watchdog.
  • Example app rewritten for the current API: presets, start / stop, positionStream, motionStream, heartbeatStream, statusStream, periodic healthCheck(), GNSS warm-up and switches for IndoorConfig.robust, anchorTrailExitEnabled and the still probe (applied with updateConfig). New example/README.md; minSdk 24 like the plugin; cleartext HTTP removed from the example manifest.
  • Repository tidy-up for GitHub: generated files removed, .gitignore / .pubignore cover Flutter tool output with local paths, README has git-dependency install, the new options in the feature table and a License section; the offline replay tool is now test/replay/replay_field_log_test.dart.
  • README: new section "GNSS warm-up (offline readiness)" with examples and honest caveats (best effort, OS dependent, no guarantee that assistance data is downloaded).
  • Package layout for pub.dev: .pubignore / .gitignore exclude logs, releases, APKs, keystores and build outputs; example/ is now a minimal app; analysis_options.yaml uses flutter_lints; dartdoc added.
  • Privacy cleanup of docs and tests: sample coordinates are now a public landmark, no device model or building details.

0.10.1 #

  • LocationPermissionFlow also requests activity recognition (Android 10+ ACTIVITY_RECOGNITION / iOS Motion & Fitness) after the notification step. An in-app prompt is shown when the permission is not already granted (PermissionFlowTexts.activityRecognition, PermissionStep.activityRecognition, run(activityRecognition:)). Declining that prompt skips the request but does not cancel the flow: tracking can start without it.
  • README Quick start now runs LocationPermissionFlow.run(context) before startService.

0.10.0 #

Tracking presets: one switch for the battery / accuracy trade-off, changeable while the service runs.

  • TrackingPreset (powerSaver, balanced, highAccuracy, custom). Build a config with LocationConfig.forPreset(preset, base:, intervalMs: ...) / config.withPreset(...): the preset replaces the tuning fields (interval, distance filter, priority, GNSS measurements / full tracking, accuracy gates, the still / anchored low-power switches, batching) and keeps everything else (notification, send, ...). Named arguments override single preset values; custom applies no preset values, only the overrides.
    • powerSaver: balanced-power priority all the time, 30 s / 25 m, no GNSS measurement listener, no full tracking, accuracy gate 50 m (coarse limit 100 m). Roughly 20-50 m fixes.
    • balanced (default): exactly the 0.9.0 behaviour.
    • highAccuracy: high priority every second, full tracking, GNSS measurements and IMU on, no batching, never drops to balanced priority while still or anchored.
  • FlutterGetBackgroundLoc.setPreset(preset, {overrides}) switches a running service without restarting it (Android: new native applyPreset: the fused request, the GNSS measurement listener and the sensors are re-applied in place; iOS falls back to updateConfig). The background filter re-evaluates the low-power switch right away. Before startService it only prepares the config (returns false).
  • New LocationConfig fields: preset, priority (LocationPriority.high / balanced, the priority while moving) and enableGnssMeasurements (false = the measurement listener is never registered; it keeps the receiver tracking at 1 Hz). Also LocationConfig.copyWith(...).
  • The active preset is reported in healthCheck() (HealthStatus.preset, priority, gnssMeasurementsEnabled), in the presetChanged status event, in every heartbeat and in every fix (LocationFix.preset, payload group quality, opt out with payload.quality = false).
  • No "no fix" health warning for the sparse balanced base priority of the power saver.
  • README: "Tracking presets" with a battery vs accuracy table (indicative values, measured on a Xiaomi device).

0.9.0 #

Hand-held phones no longer look "moving" forever, large-accuracy fixes cannot move the position, an anchor formed on a drifting position can heal, and the receiver goes to low power as soon as the phone is anchored. Every new option is opt-out; the notes below name the switch.

  • Sustained motion + hand-jitter agreement (MotionConfig). IMU RMS above imuMotionRms counts as motion evidence only after imuMotionMinFixes (2) consecutive fixes, or at once from imuStrongMotionRms (2.0 m/s^2) up; 1 restores the old single-fix reset. While the OS activity says still AND the GNSS Doppler speed says still, a hand-held phone (RMS 0.4-1.5) is not motion: the still window may start at RMS <= imuJitterStillRms (1.0) and motion needs RMS > imuJitterMotionRms (1.5) for imuJitterMinFixes (5) consecutive fixes (handJitterEnabled, false = strict thresholds). The agreement ends the moment the activity changes or the Doppler speed rises. Field log (hand-held, indoors, 80 min): MotionState.still 0.1 % -> 34 % of the fixes, IMU still window 19 % -> 78 %. New MotionTracker.handJitterAgreement.
  • Large hAcc never moves the position. IndoorConfig.coarseMaxAccuracyMeters default 50 -> 30: a fix with hAcc above 30 m is rejected (reported with its reason, visible in the logs) and the last filtered fix is re-emitted as held. Set 50 to get the old reach back.
  • Re-anchor on a persistent cluster (IndoorConfig.anchorReanchorEnabled, anchorReanchorAfterMs 120000, anchorReanchorMinFixes 20, anchorReanchorMaxAccuracyMeters 8, anchorReanchorMaxMeters 40). The 0.8.0 anchor hold could freeze on a drifting position and then ignore the correct fixes for the rest of the stop (field log: 19 minutes, 20 m off). Fixes the anchor contradicts (beyond the hold radius or refused by the EKF) are collected; when they have persisted for 120 s and >= 70 % of them agree with their own median, the anchor moves there without motion evidence, but only within anchorReanchorMaxMeters of the old anchor: a bigger jump (the 0.8.0 persistent-jump protection) still needs motion. A fix the EKF accepts while anchored clears the collection. Counted in reanchorCount.
  • Anchored output does not expire. A rejected fix re-emitted the last filtered fix only up to holdMaxAgeMs (10 min); a long anchored stop therefore produced no position at all after 10 minutes (seen in the replay of 0.8.0). While anchored the held position is kept for as long as the anchor holds.
  • Low power while anchored (MotionConfig.balancedWhenAnchored, default true, needs balancedWhileStill). Balanced priority + stillIntervalMs / stillMinDistanceMeters start when the anchor is held without recent motion evidence (a few seconds after the fast anchor) instead of only after the 180 s stop timeout, and high accuracy returns when the anchor is released or motion/activity change is seen.
  • GNSS measurements are paused while low power (MotionConfig.fullTrackingWhileStill, default false). A registered GnssMeasurements listener keeps the receiver tracking at 1 Hz even when the location provider is OFF (seen with dumpsys location: measurements delivered every second after the balanced switch), and full tracking also disables duty cycling. The listener is unregistered in low power and registered again (with full tracking when enableFullTracking) on motion. fullTrackingWhileStill: true keeps it.
  • Replay tooling: test/replay/replay_field_log_test.dart takes FGBL_REPLAY_FROM / FGBL_REPLAY_TO / FGBL_REPLAY_IGNORE_BOOT and treats a same-second activity pair as exit + enter.

0.8.0 #

Stationary anchor: no more snapping to a persistent GNSS jump, a faster anchor, and GNSS Doppler speed as a third still/motion input. Every new option is opt-out and the defaults are safe; setting them off restores the 0.7.x behaviour.

  • Anchor hold (fix). In 0.7.x a frozen anchor rejected a far fix by the EKF Mahalanobis gate only. While rejecting, the predicted covariance kept growing (about with time cubed), so after ~1-2 minutes the same wrong cluster passed the gate and the output snapped to it without any motion (seen in a field log: a 77 m snap at still: true). Now (a) a fix farther than the exit radius max(anchorExitMinMeters, anchorExitAccuracyFactor x accuracy) never reaches the EKF while anchored, however long it persists (IndoorConfig.anchorHoldEnabled, default true; counted in LocationFilterEngine.anchorHeldCount), and (b) the position 1-sigma is capped while anchored (anchorMaxPositionStdMeters, default 2.0 m, 0 = off; AdaptiveKinematicEkf.stationaryMaxPositionStd). The anchor is left only by motion AND anchorExitConsecutive consecutive outside fixes, or by the Doppler speed exit below.
  • Fast anchor. When the IMU window, the OS activity (still) and GNSS Doppler speed (< 0.5 m/s with a usable speedAccuracy) all agree, the anchor engages after fastAnchorAfterStillMs (10 s) instead of 45 s (fastAnchorEnabled, fastAnchorMinFixes 5, fastAnchorRequireActivity true). The 45 s path stays as the fallback. A vehicle idling at a red light (activity vehicle) never qualifies. fastAnchorRequireActivity: false lets IMU + GNSS speed decide (no activity-recognition permission). Counted in fastAnchorCount.
  • GNSS Doppler speed as a third input (MotionConfig.gnssSpeedEnabled, gnssStillSpeedMps 0.5, gnssMovingSpeedMps 1.0, gnssSpeedMaxAccuracyMps 1.0, gnssSpeedMinFixes 3). Hysteresis (still < 0.5, moving >= 1.0, dead band keeps the state), a state flips after 3 consecutive fixes, and a fix without a usable speedAccuracy is ignored. "Moving" is motion evidence like IMU motion: it ends the still window and blocks a new one, so a smooth vehicle (train, car on a motorway) with a quiet IMU no longer reaches MotionState.still or an anchor. "Still" never forces the still state on its own (it is one vote of the fast anchor). New MotionTracker.onSpeed, gnssStill, gnssMoving, gnssMovingForMs, activityStill, isStillAgreed.
  • Speed exit. While anchored, sustained Doppler "moving" releases the anchor at once, even while the fixes are still inside the exit radius, so walking, cycling and driving are not sticky (IndoorConfig.anchorSpeedExitEnabled, default true).
  • Vehicle model, drive mode and red-light behaviour are unchanged.
  • Offline replay tool: test/replay/replay_field_log_test.dart runs a field log (JSON lines) through the filter (set FGBL_REPLAY_LOG, optional FGBL_REPLAY_OUT).
  • Tests: test/anchor_hold_test.dart (21 cases: persistent 50/80 m jump for 150 s stays put, the 0.7.x leak reproduced with the options off, walking exits within 5 fixes by speed and within ~25 s without a speed, fast-anchor agreement and fallbacks, red light, smooth vehicle, hysteresis, config round-trip).

0.7.1 #

  • Android notification crash: an unescaped } in the live-text placeholder regex threw PatternSyntaxException during NotificationSupport initialization. createChannel() failed with it, the fallback notification was posted on a missing channel, and Android killed the app with CannotPostForegroundServiceNotificationException (then "crashed too many times"). The regex now escapes both braces (initialized lazily). The fallback path creates the default channel itself and never touches NotificationSupport, and it logs the exception class and stack.
  • Comment typo: an Indonesian example in BackgroundDisclosureTexts.footer docs is now English.
  • Bundled notification icon: fgbl_ic_location is now hard-referenced and listed in res/raw/keep.xml so release builds with shrinkResources no longer strip it (it was reported missing and the launcher icon was used).

0.7.0 #

Everything user-facing is customisable. All new options are optional and the defaults reproduce 0.6.x.

  • NotificationConfig (Android): locationDisabledText, channelDescription, importance (NotificationImportance), visibility, color / colorized, largeIconName, subText, bigText, showTimestamp, showBadge, ongoing, liveTextTemplate / liveTitleTemplate (placeholders such as {speedKmh}, {accuracy}, {lat}, {time}), mockLabel, liveUpdateIntervalMs, tapAction (openApp / deepLink / none) + tapDeepLink, and up to 3 custom actions (NotificationAction: stop, openApp, deepLink, event -> status notificationAction). The class moved to models/notification_config.dart (same public export) and gained copyWith.
  • Runtime updates: updateNotification(NotificationConfig) re-posts the notification without restarting tracking and persists it for automatic restarts; setNotificationText / clearNotificationText show your own title/text. iOS: no-op.
  • Icons: names resolve in drawable then mipmap; a missing resource falls back to the launcher icon, emits error: notificationIconMissing once and shows in healthCheck() (notificationIconResolved, notificationLargeIconResolved) and HealthStatus.warnings. New bundled monochrome fgbl_ic_location. The resume notification now uses the configured icon.
  • Permissions: LocationPermissionFlow.run (rationale, permanently-denied/settings, location switch off, Play disclosure, "Allow all the time" hint, notification step) with PermissionFlowTexts / PermissionPrompt, skip, promptBuilder; granular permissionState() (LocationPermissionState); iOS checkIosUsageDescriptions() + IosUsageDescriptions (suggested Info.plist wording).
  • Texts: HealthStatus.warningsWith(HealthWarningTexts), RestartConfig.resumeChannelName.
  • README: new "Customization" section.

0.6.0 #

Drive mode, road-hugging and pluggable road snapping. Everything is opt-in/opt-out; a disabled feature costs nothing.

  • DriveModeDetector (drive.enabled, default on, pure logic): enters on OS activity vehicle or 20 s above 15 km/h (both need > 10 km/h), exits after 60 s below 7 km/h (a traffic light never exits), walking activity 30 s, still activity 60 s, or motion state still. Ignored while mock-flagged. driveMode is on LocationFix, the payload (group motion), MotionUpdate (+ driveReason), Heartbeat and healthCheck().
  • Vehicle EKF model (drive.vehicleModel, drive mode only): anisotropic process noise rotated by the heading (lateral 0.2x), soft zero-lateral-velocity pseudo-measurement against a lagged heading, more course trust above 5 m/s with course accuracy < 15 degrees. Skips itself when the course is useless (>= 25 degrees) and during turns (covariance re-opened). Walking/still behaviour is bit-for-bit unchanged. Measured: lateral error 2.6 -> 1.3 m without course, ~-30 % with a 15 degree course, neutral with a good course.
  • iOS: new method-channel call setActivityType; IosConfig.driveActivityType (default automotiveNavigation, null = never switch) is applied on drive-mode enter, ios.activityType restored on exit. README documents the unmapped-road risk.
  • FilterConfig.driveElasticity (default true): in drive mode uploads are thinned to a speed-proportional distance (drive.elasticSeconds x speed, 5..60 m, at least every 10 s).
  • RoadSnapper interface (+ SnapInput, SnapPoint): runs only in drive mode on a 5-10 fix sliding window, max one call per 5 s, 8 s timeout, failures deliver the fixes unsnapped. Adds snappedLatitude, snappedLongitude, snapConfidence (payload group snap) and snappedFixStream; raw coordinates are kept.
  • LocationConfig.backgroundEntrypoint + runFlutterGetBackgroundLoc({roadSnapper}): your own background entry point (Android DartEntrypoint, iOS FlutterEngine.run(withEntrypoint:libraryURI:)), the only way to plug objects into the background isolate.
  • example/: OsrmRoadSnapper (dart:io, /match/v1/driving, configurable base URL; the default is the public demo server - demo only, rate limited) and a switch in the example UI.
  • Tests: drive_mode_test.dart (hysteresis incl. traffic light, vehicle model on a straight road and in a turn, config round trips, elasticity, RoadSnapper contract with a fake, disabled features start nothing, iOS activity-type switching).

0.5.4 #

Field-test round on a real Android phone (high floor, next to a window, developer options ON, no mock app).

Fixes

  • False mock-GPS detection. One heuristic layer (imuStationaryButMoved, weight 0.6) was enough to pass suspectThreshold, so GNSS multipath wander on a still phone flagged ~30 % of fixes as mock. Now mockSuspected needs an OS mock flag, or heuristic score >= threshold and MockConfig.minIndependentSignals (default 2) independent layers (IMU-vs-GNSS, teleport, native). Developer options never count. IMU drift is also treated as drift when the sky view is poor (indoorScore >= 0.3). New LocationFix.mockByOsFlag / mockByHeuristics tell hard and soft evidence apart.
  • Indoor was never detected near a window. Measured: mean C/N0 22-25 dB-Hz, 14-24 of ~75 satellites used, phone still -> score 0.496, just under the 0.5 threshold. Retuned: low C/N0 threshold 25 -> 28 dB-Hz (IndoorConfig.indoorMinCn0), weights lowCn0 0.35 / manyVisibleFewUsed 0.25 / imuStill 0.15, "many visible, few used" ratio 0.3 -> 0.4 (indoorUsedRatio), new veryLowCn0 cue below indoorVeryLowCn0 (20). The same data now scores 0.59; open sky (C/N0 38, 50 % used) stays outdoor. Calibration tests use the measured values.

Opt-in / opt-out for everything

  • New LocationConfig.enableGnssStatus, readWifiState, readBattery: when false the native side does not register the GNSS listeners / never reads Wi-Fi or battery (Android) and iOS leaves battery monitoring off. mock.enabled=false now also skips the native mock check.
  • New SendConfig.payload: PayloadConfig(speed, bearing, altitude, gnss, imu, mock, indoor, motion, barometer, device, quality) chooses which groups of fields are uploaded.
  • indoor.enabled=false now emits no score/reasons at all.
  • README: new "Features & configuration" table listing every feature with its flag, default and platform.
  • Tests: opt_out_test.dart (disabled features start nothing / emit nothing).

English only

  • All user-visible defaults are English: notification and resume texts, background-location disclosure, OEM autostart guide, health warnings, send errors, the example app. README rewritten in English; comments and tests translated.

0.5.3 #

  • Keep-alive restart alarm (RestartConfig.keepAliveMs, default 15 min, 0 = off). On a real Xiaomi/HyperOS phone a hard process kill (SIGKILL / am crash / OEM killer) was not recovered by START_STICKY: tracking stayed dead until the user opened the app. While tracking, the service now keeps a setExactAndAllowWhileIdle alarm armed keepAliveMs ahead and slides it forward from its watchdog, so it only fires after the process died; RestartReceiver then restarts the service (same eligibility rules/restartBlocked handling as other restarts). Cancelled on stop()/notification Stop. Verified on device: kill -9 -> service back in ~94 s with a 2 min window.

0.5.2 #

Found on a real device (Xiaomi, HyperOS).

  • Uploader sent every POST with Transfer-Encoding: chunked (dart:io default). Many servers/proxies read a chunked body as empty (Content-Length: 0, HTTP 400) so records were bisected away and dropped. Both KeepAliveHttpPoster and oneShotHttpPoster now encode the body and set contentLength (no chunking). oneShotHttpPoster / defaultHttpPoster are exported. Tests assert length + non-chunked.

0.5.1 #

Fixes from mining the issue trackers of other location packages.

P0

  • Removed DartPluginRegistrant.ensureInitialized() from the background entry point (root isolate of a headless engine; flutter_background_service #375/#428 saw release crashes). Plugins still register through the engine (Android FlutterEngine(context), iOS BackgroundEngine).
  • PersistentQueue: every line is jsonDecoded on load (must be a JSON object); corrupt / torn lines are discarded and counted (corruptLines, status queueCorrupt); atomic rewrite (temp + rename), flushed appends, missing trailing newline repaired, invalid UTF-8 tolerated.
  • 4xx bisect: a rejected batch is split recursively so only the bad record(s) are dropped; transient errors while bisecting keep the rest queued. SendResult.droppedCount, LocationUploader.droppedCount.

P1

  • uuid (random v4, no packages) + persisted monotonic seq on every payload (SendConfig.recordIds, default on; retries keep the same ids). README documents server-side dedup/ordering. New Uuid, SequenceCounter.
  • Android start pre-check: LocationService.start() runs permission / background-start eligibility checks (same rules as RestartScheduler) and returns the reason instead of starting (startService -> false, error + status startBlocked, healthCheck().startBlocked); ForegroundServiceStartNotAllowedException / SecurityException -> startForegroundFailed. startForeground() is the first thing in onStartCommand (minimal fallback notification), ConfigStore.load is memoised and prewarmed off the main thread, later failures are reported (startFailed).
  • BackgroundLocationDisclosure: Indonesian prominent disclosure (customisable texts / builder) shown before the system prompts; README section on the Google Play declaration, demo video, privacy policy, data safety.

P2

  • ExactAlarmPermissionReceiver (ACTION_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED): re-arms the restart and clears restartBlocked when granted; status exactAlarmGranted / exactAlarmRevoked.
  • Wi-Fi flags: healthCheck().wifiEnabled / wifiScanAvailable (+ warning), LocationFix.wifiOn, indoor reason wifiOff (0.10, only with poor accuracy). ACCESS_WIFI_STATE added. README: the Wi-Fi radio must be on, not connected.
  • README: removing ACTIVITY_RECOGNITION with tools:node="remove".
  • iOS didFailWithError: kCLErrorDomain 1 -> permissionDenied status + error, 0 -> locationUnknown status, others -> locationError with domain/code.

Example: disclosure flow, startService result, start-blocked / Wi-Fi rows.

0.5.0 #

Power, restart and upload robustness (studied: geolocator, location, background_locator_2, flutter_foreground_task, flutter_background_service, transistorsoft). Already in 0.4.0 and extended here: balanced priority while still.

P0

  • WakeLock. useWakeLock default false; a short acquire(dispatchWakeLockMs = 10 s) wraps every batch dispatch to the isolate; the opt-in long lock always has a timeout (wakeLockTimeoutMs) that the watchdog re-acquires.
  • Restart on Android 12+/14. SCHEDULE_EXACT_ALARM declared (USE_EXACT_ALARM deliberately not - Play policy), canScheduleExactAlarms() / openExactAlarmSettings(), setAlarmClock when allowed (RestartConfig.useAlarmClock), pre-check of ACCESS_BACKGROUND_LOCATION and (exact alarms OR battery exemption); otherwise status restartBlocked + "Tap to resume tracking" notification whose tap restarts the service. SecurityException / ForegroundServiceStartNotAllowedException are caught. healthCheck() gains restartBlocked, canScheduleExactAlarms, balancedPriority.
  • Location batching. setMaxUpdateDelayMillis (10-60x interval, capped) while still or when the send interval >= 30 s; native sorts batches by timestamp; Dart drops fixes older than the last EKF update (FilterDecision.rejectedStale); flushLocations() on stop, priority/motion change and UI open (+ public API).
  • Upload batching. SendConfig.syncThreshold, maxSyncLatencyMs, wifiOnly, disableOnCellular (ConnectivityManager / NWPathMonitor), stillOnlyIfMoved / stillMoveMeters / stillHeartbeatMs, keepAlive (one shared HttpClient, KeepAliveHttpPoster); flush on motion change and manual send; JSON-array requests of up to max(batchSize, syncThreshold); flushQueue().
  • Low power when still. MotionConfig: balancedWhileStill now defaults to true, stillIntervalMs 30 s, stillMinDistanceMeters 20 (Android min update distance / iOS distanceFilter), stillIosAccuracy (hundredMeters); updates are never stopped; the stale-fix watchdog no longer fires in this mode.

P1

  • PROVIDERS_CHANGED_ACTION receiver: locationDisabled / locationEnabled status, watchdog paused, notification text updated, provider re-armed.
  • Android 14 dismissible notification: deleteIntent re-posts it + status notificationDismissed (NotificationConfig.repostOnDismiss).
  • DartPluginRegistrant.ensureInitialized() in the background entry point.
  • iOS: queue flushes wrapped in beginBackgroundTask/endBackgroundTask; optional BGAppRefreshTask (FlutterGetBackgroundLocPlugin.registerBackgroundRefresh(identifier:)).
  • iOS requestTemporaryFullAccuracy(purposeKey); fixes under reduced accuracy carry reducedAccuracy and are always quality = coarse.
  • Android first fix: setMaxUpdateAgeMillis(0) + setWaitForAccurateLocation(true) until the first fix (max 30 s).

P2

  • altitudeMsl / altitudeMslAccuracy (Android 14+).
  • iOS 17 CLBackgroundActivitySession (IosConfig.useBackgroundActivitySession).

Example app: power/batching/restart card, Wi-Fi-only, sync threshold, still-gating and wake-lock switches, exact-alarm / flush / full-accuracy buttons, BGAppRefreshTask registered. Indonesian README updated. Changed defaults: useWakeLock false, MotionConfig.balancedWhileStill true, stillIntervalMs 30 s. Unchanged: stopWithTask=false, START_STICKY, foregroundServiceType=location, no QUERY_ALL_PACKAGES.

0.4.0 #

Indoor / high-rise accuracy (Dart core + Android + iOS, no third-party packages).

  • Degraded output path. New FixQuality {good, degraded, coarse, held} on every LocationFix and payload. Fixes up to indoor.coarseMaxAccuracyMeters (50 m) are accepted as coarse (EKF R from hAcc); rejected fixes re-emit the last good filtered fix as held with ageMs and accuracy acc + k*sqrt(age). vAcc is no longer a hard gate by default (maxVerticalAccuracyMeters: null, confidence only via verticalConfidenceMeters). Gap resets are skipped while the IMU says still. Upload policy: uploadCoarse (true), uploadHeld (false), heldUploadIntervalMs.
  • Stationary anchor. After anchorAfterStillMs of IMU/activity stillness the position freezes at the accuracy-weighted mean of recent good fixes (zero velocity, tiny Q); exit needs motion evidence and consecutive fixes outside max(25 m, 2*acc).
  • Safer EKF re-init. Unconditional re-init is gone (when indoor.enabled): only agreeing rejected fixes, each accuracy <= 15 m, with IMU/activity motion; otherwise hold and inflate P (capped by reinitMaxInflation).
  • Mock heuristic. imuStationaryButMoved is suppressed when indoorLikely or the jump is < driftAccuracyFactor x accuracy; reported as reason indoorDrift (no score).
  • Indoor likelihood. IndoorScorer -> indoorLikely, indoorScore, indoorReasons (sats used, CN0, visible-vs-used, accuracy, non-GPS provider, IMU still).
  • Activity recognition from scratch. Android Activity Recognition Transition API (receiver + ACTIVITY_RECOGNITION permission helper), iOS CMMotionActivityManager (NSMotionUsageDescription). Stop-timeout state machine (MotionConfig.stopTimeoutMs, default 3 min), optional balanced priority while still, watchdog re-registration. Public rejectedFixStream (RejectedFix with reason), motionStream, heartbeatStream (background isolate, default every 60 s, optionally uploaded). New methods checkActivityRecognitionPermission, requestActivityRecognitionPermission.
  • Barometer. Android TYPE_PRESSURE + SensorManager.getAltitude, iOS CMAltimeter: pressureHpa, relativeAltitude, floorChange (~3 m/floor), floor with calibrateFloor(n), verticalMotion (lift/stairs) and verticalSpeed. Graceful when the sensor is absent.
  • Example app: quality, indoor score/reasons, motion state, floor, rejected-fix log, heartbeat, activity permission and floor calibration. Indonesian README updated.
  • Unchanged: stopWithTask=false, START_STICKY, foregroundServiceType=location, no QUERY_ALL_PACKAGES.

0.3.0 #

  • OEM battery-killer handling, written from scratch (no third-party packages) on the plugin's own MethodChannel: isBatteryOptimizationIgnored, requestDisableBatteryOptimization, getManufacturer, needsOemAutostart, openOemAutostartSettings (returns OemSettingsResult: vendor page / app-details fallback / none). Legacy isIgnoringBatteryOptimizations / requestIgnoreBatteryOptimizations remain as aliases.
  • Native OemHelper: per-vendor candidate component lists (Xiaomi, Oppo/Realme incl. ColorOS/oplus, Vivo/iQOO, Huawei/Honor, Samsung Device Care, OnePlus, Asus, Letv, HTC, Nokia, Transsion, Meizu), resolveActivity + try/catch, ACTION_APPLICATION_DETAILS_SETTINGS fallback. Plugin manifest gains a <queries> block for those packages (no QUERY_ALL_PACKAGES).
  • Dart OemBackgroundHelper.ensureBackgroundPermission(context, ...): standard request (waits for the user to return), then a themeable Indonesian guide dialog with vendor-specific steps, custom texts/steps/builder, and a natively persisted "user confirmed" flag (force/resetGuide()).
  • iOS: all of the above are no-ops. Example app: "Battery / Autostart" button + auto prompt on Start.
  • stopWithTask=false, START_STICKY, foregroundServiceType=location unchanged (verified in the merged manifest).

0.2.0 #

  • Breaking: single-owner pipeline. Native (Kotlin/Swift) only streams raw fixes to a headless background Dart isolate (flutterGetBackgroundLocBackgroundMain), which owns all filtering and HTTP upload. Native filter and native uploaders removed; SendMode.native removed (legacy value maps to dart), getQueueSize() removed.
  • Kinematic Adaptive EKF ([px, py, vx, vy] local ENU, adaptive R/Q, Mahalanobis gating, Joseph update, speed-only and zero-velocity updates) replaces the constant-velocity Kalman.
  • Null-safe quality gating: HDOP only trusted with >= 4 satellites; otherwise pure accuracy fallback. New vertical accuracy (20 m) and speed jump (150 km/h) gates. Default hAcc gate 15 m.
  • Fake GPS: IMU-vs-GNSS heuristic (SensorManager / CoreMotion), teleport check, mockScore and mockReasons; Play Integrity standard token request (requestIntegrityToken, Android).
  • Android: Doppler pseudorange-rate uncertainty metric; health reports background isolate / IMU.
  • iOS: dynamic geofence + significant change relaunch after force-quit, FlutterGetBackgroundLocPlugin.restoreOnLaunch().
  • Persistent JSON-lines upload queue with exponential backoff + jitter in Dart.

0.1.0 #

  • Initial release.
  • Android: foreground service (type location) with persistent notification, partial WakeLock, START_STICKY, restart after task removal (AlarmManager), optional boot restart, watchdog.
  • Fused (high accuracy) provider with raw GPS fallback; GnssStatus satellites / CN0 / HDOP; GnssMeasurements with setFullTracking(true) (Android 12+) and TOW-decoded + code-lock gating.
  • Fake GPS detection (isMock, isFromMockProvider, heuristics, developer options hint).
  • iOS: background location updates, significant-change relaunch, isSimulatedBySoftware.
  • Dart filter engine: warm-up buffer, HDOP / accuracy / spike gating, constant-velocity Kalman filter with Doppler velocity and multipath jump rejection (mirrored natively).
  • Native HTTP sender with persistent offline queue and exponential backoff; optional Dart sender.
  • Example field console app.
1
likes
160
points
287
downloads

Documentation

API reference

Publisher

verified publisherabedputra.my.id

Weekly Downloads

Accurate background location for Flutter with GNSS quality metrics, fake-GPS detection, adaptive Kalman filtering and offline-safe uploads.

Repository (GitHub)
View/report issues

Topics

#location #gps #geolocation #background #tracking

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_get_background_loc

Packages that implement flutter_get_background_loc