location update problem when gliding with constant speed on very calm water
Your Environment
- Plugin version: 4.11.0
- Platform: both iOS & Android
- OS version: > 15, for example 16.4.1 / all Android versions > 9.x
- Device manufacturer / model: iphone 12 Pro Max / Galaxy A8
- Flutter info (
flutter doctor): [✓] Flutter (Channel stable, 3.10.1, on macOS 13.3.1 22E261 darwin-arm64, locale de-DE) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 14.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.2) [✓] VS Code (version 1.78.2) - Plugin config:
reset: true,
debug: false,
logLevel: bg.Config.LOG_LEVEL_ERROR,
desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
distanceFilter: 1.0,
backgroundPermissionRationale: bg.PermissionRationale(
title:
"Erlaube {applicationName} ....",
message:
"Wenn das Tracking ....",
positiveAction: 'Ändere zu "{backgroundPermissionOptionLabel}"',
negativeAction: 'Abbrechen'),
preventSuspend: true,
heartbeatInterval: 60,
disableStopDetection: true,
minimumActivityRecognitionConfidence: 1,
pausesLocationUpdatesAutomatically: false,
stopOnTerminate: true, // false
startOnBoot: false, // true
showsBackgroundLocationIndicator: true,
enableHeadless: false))
Expected Behavior
The app (the library) works perfectly with the app in background, in foreground and in lock screen mode when the app is used for example with a smartphone that is held in the hands while walking or any similar activity. But if the smartphone lays on board of a boat that glides with a constant velocity of (for example) 1 m/s through very calm water (almost no waves) it stops sending location updates after a while. This is probably because the motion sensors does not sense any acceleration. If I wear the smartphone on a smartphone holder at my arm, it also works perfectly, because the arm is moving while sailing.
Actual Behavior
I tried all kinds of combination of config settings, but no setting combination solves the problem. Maybe somehow the internal GPS sensor thinks that there is absolutely no movement while gliding through the water and stops sending location updates to the library. I also tried "disableMotionActivityUpdates" with true/false. My Question: Is this maybe a restriction of the smartphone hardware or the OS that cannot be overcome by any setting of the library? !! Important: I need a background location update every second, even when moving in calm water !!
Steps to Reproduce
(see section expected behavior)
Context
Running a regatta tracking application (see https://www.regattahero.com)
Debug logs
Logs
PASTE_YOUR_LOGS_HERE
- see wiki “Debugging”. Learn to fetch plug-in logs using .emailLog method.
- You can manually engage tracking using .changePace(true)
We are seeing somewhat similar behaviour
Thank you for the very quick reply! I tried ".changePace(true)" but had the problem that the app started to react funny after a while when I executed ".changePace(true)" every second. Now I will try to reproduce this using your official example code and come back with the results. Thanks again for the info.
executed ".changePace(true)" every second
Why would you ever execute that every second. If you do that, you’re not understanding what it does.
Yes, I was afraid of this answer. If I execute it only once, I continue to have the problem that the location updates stop after a while. I also tried to execute it only if the location updates stop. That is why I am hoping for help.
that the location updates stop after a while
of course they do, that’s the point of this plug-in. Read the wiki “Philosophy of Operation” and the api docs Config.stopTimeout.
stopTimeout, yes, I oversaw that in the docs, you made my day!
I read "Philosophy of Operation" again and I added "stopTimeout: 15" to the config above. But that did not solve the problem.
I am in moving state all the time, but still not receiving location updates although the device is moving. My explanation is, that the movement is so constant that the device just does not seem to know that it is moving because it cannot sense any acceleration at all, even with "minimumActivityRecognitionConfidence: 1".
I will now make sure that I activate the logs and study them in more detail. Still don't know if maybe there is a restriction of the smartphone gps hardware or the OS when absolutely no acceleration is in place and that this cannot be overcome by any setting of the library. The logs will hopefully tell.
I’ve tracked on boat rides before. Some of my customers have used it for boat-tracking apps before. Test distanceFilter: 0
Wow, after first tests "distanceFilter: 0" seems to do the trick!
I tested it on an iPhone and distanceFilter: 0 seems to activate time-based location tracking even on an iOS device. ("Philosophy of Operation" seems to indicate that time-based location updates only works on Android)
Docu says you must set locationUpdateInterval when setting distanceFilter: 0. In my case locationUpdateInterval: 1000.
Does "locationUpdateInterval" have an impact on iOS devices too? Or which time interval is used on iOS devices? In my tests it seems to be 1000 ms when distanceFilter is set to 0 even when locationUpdateInterval is not set at all.
distanceFilter: 0 is essentially as fast as possible (~1Hz). You just can’t do it any slower.
So if I do not set locationUpdateInterval on both Android and iOS it is ~1Hz. That would be perfect for me.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.