distanceFilter and intervalDuration at the same time causing multiple updates
💬 Questions and Help
Hello,
I'm facing a weird behavior on Android and I would like some advice.
I'm using this code to subscribe to location updates :
Geolocator.getPositionStream(
desiredAccuracy: LocationAccuracy.best,
distanceFilter: 10, // 10m before any location update
intervalDuration:
Duration(milliseconds: 10000)) // 10 seconds between two updates
.listen((Position position) {
First, I wonder if I can use distanceFilter and intervalDuration at the same time. I suppose I can.
It seems that the distance filter works fine but when it's triggered, I got 4 more location updates at 5 seconds interval (although I ask for 10s) and then the updates stops until the next 10 meter barrier break.
For the purpose of the experiment, I'm using the AVD and I noticed something. I'm changing the location from the AVD settings and the distance between the two points is high (like 3km) and cannot be possible in real-life (or you run faster than light :) ).
I tried without intervalDuration and the location update is triggered many times. It's like Android is not able to update the location coordinates fast enough and I see my marker going near the destination and moving slowly the it during the multiple updates.
Is it normal ? If not, how can I fix it ? Thx !
Thanks @maxouille for reporting your issue. On Android, distanceFilter and intervalDuration can be used at the same time (in iOS intervalDuration is not supported).
I could not reproduce your issue using the AVD, can you provide more information about the setup you're using?
flutter doctor -v- Does the issue occur on a local device as well?
- Which version of geolocator are u using
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
Currently I'm experiencing wrong behavior with the intervalDuration similar as the one described here. In my case I tested with multiple values for intervalDuration and the location update was received in half of the specified duration every time, for instance:
intervalDuration: Duration(seconds: 10);the location was received every 5 secondsintervalDuration: Duration(seconds: 20);the location was received every 10 seconds
and so on
Same issue as @luis901101 here~