-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Geolocation] watchPosition callback has very unpredictable frequency #1240
Comments
@opolyo01 - the geolocation module uses From the docs on it:
It might make sense to have this be configurable, but you'll have to keep in mind that greater degrees of accuracy result in higher battery usage. Any reason not to expose this @nicklockwood? If you'd like to get the updates every |
There's no reason not to expose the accuracy, but it should be done so in a way that's compliant with the HTML5 Geolocation API as far as possible. I thought we already did this, but I guess I misremembered. |
@nicklockwood - poor wording on my behalf - |
What about monitoring significant updates only? It feels like the most reasonable approach would've been to implement own geolocation where HTML5 compliancy does not matter. |
It would be useful to expose this API more completely. After a basic look into it, we seem to be missing a large amount of control over the location API when making it comply with HTML5. Perhaps I'm wrong, that's my initial take as I work through using this. |
@christopherdro I've upgraded to rn 0.20.0-rc1 which should include your update, right? I'm still experiencing a similar issue, where I only get location updates once every ~25 seconds. Even using the following options: |
@joshblour Are you testing in iOS or Android. Did you try setting distance filter to |
@joshblour @christopherdro the distanceFilter commit was merged master but has not landed in any release yet. You might consider cherry picking #5563 in the meantime. |
Do navigator.geolocation.getCurrentPosition work and navigator.geolocation.watchPosition work on android? I'm just getting a timeout error. I've got |
Is it possible distanceFilter is completely ignored on iOS? I've set it to a ridiculously high number but the callback is triggered very frequently without any or just small change in the coordinates. |
I am having the same issue as @dominicmh. On Android the distanceFilter option seems to be also ignored and I get responses every 20 seconds. I would really like to only update my location when it changes by 5 meters. Does anyone know how to achieve this? My code is as below
I even tried setting the distanceFilter to something crazy like 200 but it still updates every 20s |
distanceFilter seems to be ignored for me too (ios, latest React from npm) |
I still can't get updates at the frequency I want. When I use react-native-maps and turn on the showsUserLocation option the blue dot moves around with a much greater frequency than my |
@Jonrock23 did you ever figure out how to only get the updated locations once it's changed by 5 metres? |
@christopherdro I am having the same issue for IOS. Has this issue you resolved only work for android? It says in the react-native-background-geolocation repo:
Can anyone tell me if this is still the case? |
@npomfret @willyyang Are you having this problem for IOS or Android? |
I'm having the problem on iOS. If I use react-native-maps I see the blue user dot moving around with great frequency, but the calls backs my RN app sees aren't anyway near as frequent. |
Thanks. I'm going to see what its like for android. |
I'm experiencing the issue where location updates are triggered every ~100m even if I set |
My solution was to call the "navigator.geolocation.getCurrentPosition" function inside a "setInterval" function. |
The |
I'm using the following options for
|
@Isei How frequent is it, as in how much metres do you travel for it to return locations? Just asking because if you're zoomed out it appears to be accurate but the more you zoom in you realise how inaccurate it is. |
I am building an app that updates the distance from current location, but for some reason I am not getting a consistent callback frequency for navigator.geolocation.watchPosition
It seems like something reseting the watch. My code has only componentWillUnmount where it would reset, but I put Alert it never occurred.
Is there frequency parameter I can specify or I guess I am thinking to go with manual timeout approach.
The text was updated successfully, but these errors were encountered: