-
Notifications
You must be signed in to change notification settings - Fork 616
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
fix(geolocation)!: use getCurrentLocation for single location #582
Conversation
I've tested these changes and they seem to resolve the issue for getCurentPosition, but watchPosition is still producing 'location unavailable'. It seems like fusedLocationClient.requestLocationUpdates is simply not providing us with any valid updates? |
yeah, it will only fix getCurrentPosition, watchPosition code didn't change (other than removing a few parts used only by getCurrentPosition) |
I see! We get two responses to watchPosition; one successful and another failure, so basically both methods (onLocationResult and onLocationAvailability) are called.
|
We currently resolved this for our use-case by removing the onLocationAvailability method from the locationCallback in requestLocationUpdates. We check the permission before we start watching the location and we don't mind if the watchLocation will continue running even if there is some kind of reason for there to be no location data, for now. |
Sadly the location being enabled/disabled has little to do with the geolocation permission being accepted/rejected, it can be disabled globally, so even if users accept the geolocation permission, the app will still hang if the location is disabled globally and you remove that function. I've been investigating and it might be possible to detect if the location is disabled, so I might send a PR after this one gets merged that checks if the location is enabled instead of relying on the onLocationAvailability |
We went with #589 for now as it fixes the problem for both watchPosition and getCurrentPosition without introducing breaking changes. We will eventually do this change in the future as it's better to use |
BREAKING CHANGE:
getCurrentPosition ignores the timeout
sendLocation
removesint timeout
andboolean getCurrentPosition
parameters.requestLocationUpdates
removesboolean getCurrentPosition
parameter, usesendLocation
for requesting a single location.closes #571