I was using Geolocation from 'react-native-geolocation-service' library and the details are as follows. My mobile app is heavily depended on location (geo coordinates) hence getting the lat/lon correctly is a must. The problem I am facing is that android is returning the cached position. I have removed the maximumAge parameter in my code but still I am getting the cached lat long in android. Is there a way that I can always get the current location from the GPS in android in react native using this library? Any help is appreciated. Thanks.
AndoidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Location.js:
import Geolocation from 'react-native-geolocation-service';
getCoordinates = () => {
Geolocation.getCurrentPosition(
position => {
this.setState({
latitude: position.coords.latitude,
longitude: position.coords.longitude,
});
},
error => {
}, { enableHighAccuracy: true, timeout: 15000 },
)
};
from react native geolocation for android returning cached position
No comments:
Post a Comment