-
-
Notifications
You must be signed in to change notification settings - Fork 666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is distanceFilter working for AppleSettings? #1116
Comments
Hey @ahaaje, thanks for reporting your issue. I'm not able to reproduce your issue, and the code in regard to the distanceFilter seems fine to me. The distanceFilter should work fine on iOS/macOS. I can imagine that the ActivityType.automotiveNavigation has an impact on the Position Stream, since the ActivityType is tracking location changes to the automobile. Can you try removing the parameter and see in what way the PositionStream behaves? If the issue still occurs, can you help me by uploading your code in this thread, together with your |
It did not make any difference in the simulator when I removed the setting. I keep getting updated with 32-33 meters distance, even though the distanceFilter is set to 50m. I will provide more feedback when having seen the updated in action on physical devices. |
We can see the issue on iOS 16 simulator as well. Even though position is not changing at all the stream continues to fire callback every 1 second (with the same position value). pauseLocationUpdatesAutomatically is set to true; Changing activityType, accuracy and distanceFilter does not seem to have any effect. |
Same here with @Sayene , any solutions ? |
Thanks for the information. I was calling the getCurrentPosition() in a method to send current location to server. Instead, I used a workaround to store the last known position inside the stream updates, and send this to the server when needed. That is the best alternative I found. You only need to call the getCurrentPosition() once when initializing your geolocator instance. Code:
|
Facing similar issue |
Is there any update on this issue cuz it's few months we are facing this issue. |
i am also facing same issue |
Hi any update |
Same issue. |
Refer to my response earlier. You have to get the last known position first. You only need to call the getCurrentPosition() once when initializing your geolocator instance. |
Thanks for this suggestion @skillastat |
I don't know @saurabhkumar8112, I first used the documentation to setup my app. Taken from https://pub.dev/packages/geolocator
Geolocator.getCurrentPosition() is checking for the real location of the device. This being said, I had an issue in wich at some point in my app lifecycle, the stream was not updating anymore (After a couple hours). But this didn't happen everytime.... it was an elusive problem that I had to work around. So now, what I do is check every 15 minutes if our Geolocator.getCurrentPosition() is > 100 meters from our last known position. If it is, we reset our stream. This seems to have fixed my problem since the last update I pushed to my users.
|
Here's a PR to the library that fixes the issue in your comment #1600 |
💬 Questions and Help
I have initialized my Geolocator stream for iOS like this
However, I seem to be receiving updates every second regardless of distance. This is an example of data received
For a 64 km drive, this resulted in 3586 updates with an average distance of 17.7 meters. The huge number of updates use processing time and power, and storage. I set my distanceFilter to 50 meters to prevent that many updates, but it seems to be not working. Is there a way to do that?
The text was updated successfully, but these errors were encountered: