'react-native-location not updating with latest location on android - always return the cache location
react native package - https://www.npmjs.com/package/react-native-location
location is not updating on android. It always return the cache location. But once we re-install / clear cache the app it will take the latest location. Works fine on ios.
const getCurrentLocation = async (callback) => {
RNLocation.configure({
distanceFilter: 10,
desiredAccuracy: {
ios: 'best',
android: 'highAccuracy',
},
androidProvider: 'auto',
});
const location = await RNLocation.getLatestLocation({ timeout: 5000 });
callback(location);
};
...
const hasPermission = await RNLocation.checkPermission({
ios: 'whenInUse',
android: {
detail: 'coarse',
rationale: {
title: strings.enableLocationMessage,
message: strings.enableLocationMessage,
buttonPositive: strings.ok,
buttonNegative: strings.cancel,
},
},
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
