react-native-geolocation
react-native-geolocation copied to clipboard
Cannot getting location every time in iOS
Sometimes, my app want to getting current location to user but not every time is successful.
Geolocation.getCurrentPosition(
({ coords: { latitude, longitude, accuracy } }) => {
setUserLoc({
...userloc,
latitude,
longitude,
accuracy,
});
Geolocation.watchPosition(
({ coords: { latitude, longitude, accuracy } }) => {
setUserLoc({
...userloc,
latitude,
longitude,
accuracy,
});
},
error => {
console.log('watch user position: ', error);
sendToSlack(
'Error Watching Location on _getCurrentPosition App.js',
error,
);
},
{
enableHighAccuracy: true,
timeout: 20000,
maximumAge: 5000,
distanceFilter: 10,
},
);
setTimeout(() => Geolocation.clearWatch(), 300000);
},
error => {
console.log('error accessing location: ', error);
},
{ enableHighAccuracy: true, timeout: 20000, maximumAge: 5000 },
);
I think it will be success in first time only. another time it will be error like this:
{
"code": 3,
"message": "Unable to fetch location within 20.0s.",
"PERMISSION_DENIED": 1,
"POSITION_UNAVAILABLE": 2,
"TIMEOUT": 3
}
I have set NSLocationAlwaysUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription in my info.plist
Please help
Im having the same issue i have to close and reopen the app completely for it to work again
++
++
same here .... but for me 8/10 fails now :(
getCurrentPosition never retrieves with data however the permission is granted
@michalchudziak pls investigate this ASAP, this is extremely frustrating and we are blocked to release our app just because of this... this was the official plugin right?
Thanks for reporting this problem. It should be solved in 3.4.0 release.