Open sergiomartell opened 4 days ago
I know how GPS works, but a 2 kilometer discrepancy is not normal, 50 meters being inside is acceptable.
It’s due to your device (settings) and / or environment.
open Google maps and you’ll experience the same phenomenon.
Google Maps is getting my location to 5 meters on the device, and we are getting the same result (of an accuracy of 2km) in 2 devices a Pixel 4 and a Samsung Galaxy. And I have tested with the device outside getting also the same result. Any idea why this is happening?
I have no idea. Are you observing the plug-in logs in adb logcat
? See wiki “Debugging”.
I field test almost every day for the last 10 years. I see nothing but excellent accuracy.
These are the logs: I/flutter (12202): "notification": { I/flutter (12202): "layout": "", I/flutter (12202): "title": "", I/flutter (12202): "text": "Location Service activated", I/flutter (12202): "color": "", I/flutter (12202): "channelName": "TSLocationManager", I/flutter (12202): "channelId": "", I/flutter (12202): "smallIcon": "", I/flutter (12202): "largeIcon": "", I/flutter (12202): "priority": -1, I/flutter (12202): "sticky": false, I/flutter (12202): "strings": {}, I/flutter (12202): "actions": [] I/flutter (12202): }, I/flutter (12202): "params": {}, I/flutter (12202): "persist": true, I/flutter (12202): "persistMode": 2, I/flutter (12202): "schedule": [], I/flutter (12202): "scheduleUseAlarmManager": false, I/flutter (12202): "speedJumpFilter": 300, I/flutter (12202): "startOnBoot": true, I/flutter (12202): "stationaryRadius": 50, I/flutter (12202): "stopAfterElapsedMinutes": 0, I/flutter (12202): "stopOnStationary": true, I/flutter (12202): "stopOnTerminate": false, I/flutter (12202): "stopTimeout": 5, I/flutter (12202): "triggerActivities": "in_vehicle, on_bicycle, on_foot, running, walking", I/flutter (12202): "url": "https:\/\/us-central1-aqui-no-d98af.cloudfunctions.net\/\/BackgroundGeolocation", I/flutter (12202): "useSignificantChangesOnly": false, I/flutter (12202): "enabled": true, I/flutter (12202): "schedulerEnabled": false, I/flutter (12202): "trackingMode": 1, I/flutter (12202): "odometer": 0, I/flutter (12202): "isFirstBoot": false, I/flutter (12202): "didLaunchInBackground": false, I/flutter (12202): "didDeviceReboot": false I/flutter (12202): } I/flutter (12202): ╠═════════════════════════════════════════════ I/flutter (12202): I/flutter (12202): 09-30 11:17:31.134 DEBUG [LocationAuthorization withBackgroundPermission] I/flutter (12202): ℹ️ LocationAuthorization: Permission granted I/flutter (12202): 09-30 11:17:31.140 DEBUG [HttpService startMonitoringConnectivityChanges] I/flutter (12202): 🎾 Start monitoring connectivity changes I/flutter (12202): 09-30 11:17:31.141 DEBUG [DeviceSettings startMonitoringPowerSaveChanges] I/flutter (12202): 🎾 Start monitoring powersave changes I/flutter (12202): 09-30 11:17:31.145 INFO [ActivityRecognitionService start] I/flutter (12202): 🎾 Start motion-activity updates I/flutter (12202): 09-30 11:17:31.149 INFO [HeartbeatService stop] I/flutter (12202): 🔴 Stop heartbeat I/flutter (12202): 09-30 11:17:31.170 INFO [TSLocationManager a] I/flutter (12202): ╔═════════════════════════════════════════════ I/flutter (12202): ║ motionchange LocationResult: 1 (343508ms old) I/flutter (12202): ╠═════════════════════════════════════════════ I/flutter (12202): ╟─ 📍 Location[fused 19.423423,-99.175954 hAcc=2000.0 et=+5d5h13m25s942ms], time: 1727716307661 I/flutter (12202): I/flutter (12202): 09-30 11:17:31.171 DEBUG [TSLocationManager a] Median accuracy: 2000.0 I/flutter (12202): 09-30 11:17:31.188 DEBUG [LocationAuthorization withPermission] I/flutter (12202): ℹ️ LocationAuthorization: Permission granted I/flutter (12202): 09-30 11:17:31.213 DEBUG [AbstractService a] I/flutter (12202): 🎾 start [LocationRequestService startId: 1, eventCount: 1] I/flutter (12202): 09-30 11:17:31.215 INFO [SingleLocationRequest startUpdatingLocation] I/flutter (12202): 🔵 [SingleLocationRequest start, action: 1, requestId: 1] I/flutter (12202): 09-30 11:17:31.217 DEBUG [AbstractService a] I/flutter (12202): ⚙️︎ FINISH [LocationRequestService startId: 1, eventCount: 0, sticky: true] I/flutter (12202): 09-30 11:17:31.254 DEBUG [AbstractService a] I/flutter (12202): 🎾 1:1 [LocationRequestService startId: 2, eventCount: 1] I/flutter (12202): 09-30 11:17:31.256 INFO [TSLocationManager a] I/flutter (12202): ╔═════════════════════════════════════════════ I/flutter (12202): ║ motionchange LocationResult: 1 (26ms old) I/flutter (12202): ╠═════════════════════════════════════════════ I/flutter (12202): ╟─ 📍 Location[fused 19.423423,-99.175954 hAcc=2000.0 et=+5d5h19m9s510ms], time: 1727716651229 I/flutter (12202): I/flutter (12202): 09-30 11:17:31.256 DEBUG [TSLocationManager a] Median accuracy: 2000.0 I/flutter (12202): 09-30 11:17:31.259 DEBUG [AbstractService a] I/flutter (12202): ⚙️︎ FINISH [LocationRequestService startId: 2, eventCount: 0, sticky: true] I/flutter (12202): 09-30 11:17:31.421 DEBUG [TSLocationManagerActivity a] locationsettings I/flutter (12202): 09-30 11:17:31.422 DEBUG [TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): -2 I/flutter (12202): 09-30 11:17:31.477 DEBUG [TSLocationManagerActivity c] eventCount: 0 I/flutter (12202): 09-30 11:17:31.579 DEBUG [TSLocationManagerActivity onDestroy] I/flutter (12202): D/TSLocationManager(12202): [c.t.l.service.AbstractService a] D/TSLocationManager(12202): 🎾 start [ActivityRecognitionService startId: 1, eventCount: 1] D/TSLocationManager(12202): [c.t.l.s.ActivityRecognitionService a] D/TSLocationManager(12202): 🚘 ️DetectedActivity [type=STILL, confidence=100] D/TSLocationManager(12202): [c.t.l.service.AbstractService a] D/TSLocationManager(12202): ⚙️︎ FINISH [ActivityRecognitionService startId: 1, eventCount: 0, sticky: false] D/TSLocationManager(12202): [c.t.l.service.AbstractService f] D/TSLocationManager(12202): ⚙️︎ ActivityRecognitionService.stopSelfResult(1): true D/TSLocationManager(12202): [c.t.l.service.AbstractService onDestroy] D/TSLocationManager(12202): 🔴 ActivityRecognitionService stopped I/TRuntime.CctTransportBackend(12202): Making request to: https://firebaselogging-pa.googleapis.com/v1/firelog/legacy/batchlog D/TrafficStats(12202): tagSocket(130) with statsTag=0xffffffff, statsUid=-1 I/TRuntime.CctTransportBackend(12202): Status Code: 200
I am still getting the hAcc=2000.0 And the request is for "High Accuracy"
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0-rc1)
I suggest you update your Android SDK to latest (35). Play Store Console won't even allow apps with targetSdkVersion < 33
.
Also, ensure you're using the latest version of play-services-location
(see your android/build.gradle
ext.playServicesLocationVersion
. The latest version is 21.3.0
.
After doing all that, go outside for a 1km walk. Once you return, use Logger.emailLog
to fetch the plugin's log database (which saves 3 days worth of logs).
And try installing the /example
app from this repo on your device.
You can also install it from the Play Store: https://play.google.com/store/apps/details?id=com.transistorsoft.flutterbackgroundgeolocationexample&pli=1
The demo app posts locations to the demo server at https://tracker.transistorsoft.com
I am getting this error when moving to SDK 35 Note: /Users/sergiomartell/.pub-cache/hosted/pub.dev/background_fetch-1.3.5/android/src/main/java/com/transistorsoft/flutter/backgroundfetch/BackgroundFetchPlugin.java uses or overrides a deprecated API.
It's not an error, it's a warning. It was fixed in 1.3.7
Your Environment
Plugin version: 4.16.0
Platform: Android
OS version: 13
Device manufacturer / model: Google Pixel 4
Flutter info (
flutter doctor
): Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.24.0, on macOS 15.0 24A335 darwin-arm64, locale en-MX) [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0-rc1) [!] Xcode - develop for iOS and macOS (Xcode 16.0) ! iOS 18.0 Simulator not installed; this may be necessary for iOS and macOS development. To download and install the platform, open Xcode, select Xcode > Settings > Platforms, and click the GET button for the required platform.For more information, please visit: https://developer.apple.com/documentation/xcode/installing-additional-simulator-runtimes [✓] Chrome - develop for the web [✓] Android Studio (version 2024.1) [✓] VS Code (version 1.93.1) [✓] Connected device (5 available) [✓] Network resources
Plugin config: