betracky_background_location 2.1.1
betracky_background_location: ^2.1.1 copied to clipboard
BeTracky Background Location Service — background location tracking with offline storage and upload to your own server.
2.1.1 #
Bug fixes:
offlineEnabled: truenow stores locations in SQLite even when nourlis configured. Previously the local DB write was skipped because the URL guard fired first, makinggetStoredLocations()always return empty for local-only usage.startServicenow throws aStateErrorimmediately if location permission is denied, instead of starting silently and producing no updates.- Added a
debugPrintwarning whenforegroundService: trueon Android, reminding developers to grantPOST_NOTIFICATIONSat runtime (Android 13+). Without it the foreground notification is suppressed and the OS will kill the service when the app is closed. - README: Added "Runtime permissions (critical)" section with explicit code showing
Permission.notification.request()must be called beforestartService.
2.1.0 #
New features:
- Retry queue with exponential backoff — failed uploads are stored in a local SQLite table and retried automatically (1 min → 2 min → 4 min → … → max 60 min). New
maxRetriesparameter controls the limit. Workmanager runs a periodic retry task every 15 minutes when connected. - Upload status & service state callbacks — three new stream events:
uploadStatus{success, uploaded, pending},serviceStatus{running, tracking, offlineEnabled}, andlocationCount{stored}. NewgetStatus()method for one-shot status queries. - Pause / Resume tracking —
pauseTracking()andresumeTracking()suspend/restore the location stream without losing configuration or stopping the service.isTracking()returns the current state. - Time-interval filter — new
timeIntervalparameter caps update frequency by time (e.g.timeInterval: 30= at most one update every 30 seconds), complementing the existing distance filter. - Upload full location fields — new
uploadFullData: trueflag addsaltitude,speed,heading, andaccuracyto the server payload. These fields are now always stored in the local SQLite database (schema v2 migration included). - Custom HTTP headers — new
customHeaders: Map<String, String>parameter adds arbitrary headers to every upload request, enabling any backend auth scheme. - Circular geofencing —
addGeofence(Geofence),removeGeofence(id), andclearGeofences()manage circular regions evaluated on every location fix. Entry and exit firegeofenceEventstream events with{id, event, latitude, longitude, distance}. No new native dependencies — pure Dart usingGeolocator.distanceBetween. - Stored location query API —
getStoredLocations({from, to, limit}),getStoredLocationCount(), andclearStoredLocations()expose the local SQLite database for analytics and route replay.
2.0.0 #
Breaking changes:
- Removed
betrackyTokenparameter fromstartService— no registration required. - Minimum Flutter SDK bumped to 3.29.0.
Dependency updates:
workmanagerupgraded from 0.5.2 to 0.9.0 (enum names changed to camelCase).geolocatorupgraded from 13.0.2 to 14.0.2 (getCurrentPositionnow usesLocationSettings).- Removed unused
flutter_foreground_taskdependency. - Updated
httpto 1.6.0,shared_preferencesto 2.5.5,sqfliteto 2.4.2+1,pathto 1.9.1.
Bug fixes:
distanceFilterandaccuracyparameters passed tostartServiceare now correctly applied to the geolocator stream (previously hardcoded).- Removed force-unwrap crashes (
url!,id!) — replaced with safe null guards. - Added 30-second timeout to all HTTP upload requests.
- Fixed SQL parameter binding in
deleteBatchLocationsto usewhereArgsinstead of string interpolation. - Wrapped the position stream listener in a top-level try/catch to prevent silent crashes.
- Removed
print()calls from library code — replaced withdebugPrint().
Package improvements:
- Added
repository,issue_tracker, andtopicstopubspec.yaml. - Added an
example/app. - Removed dead code:
OfflineLocationDataModeland straylib/testdraft file. - Added unit tests for
LocationDataModelandWaypointUtils.
1.0.3 #
- Minor stability improvements.
1.0.2 #
- Offline mode batch upload improvements.
1.0.1 #
- iOS background service configuration fixes.
1.0.0 #
- Initial release of BeTracky Background Location Service.
- Background location tracking with configurable distance filter and accuracy.
- Start on boot and foreground service support.
- Offline mode: store locations locally and upload in batches of 50 when back online.
- Upload locations to a custom endpoint with optional Bearer token authentication.