react-native-geolocation
react-native-geolocation copied to clipboard
watchposition() issues
timeout is not workling properly why ?
code
let watchId;
watchId = Geolocation.watchPosition(handleSuccess, handleError, {
timeout: 1000,
enableHighAccuracy: true,
interval: 15 * 60 * 1000,
maximumAge: 3000,
});
const handleError = error => {
console.log(error, 'error dataaa');
Geolocation.clearWatch(watchId);
};
const handleSuccess = async position => {
let data = {
latitude: parseFloat(position.coords.latitude).toFixed(6),
longitude: parseFloat(position.coords.longitude).toFixed(6),
};
console.log(data, 'dataaaa');
Geolocation.clearWatch(watchId);
};