react-native-geolocation
react-native-geolocation copied to clipboard
Issue is Current Location if pass the enableHighAccuracy Flase then some device is worked and enableHighAccuracy True then some device is not worked
Environment
Platforms
Versions
- Android:
- iOS:
- react-native-geolocation:
- react-native:
- react:
Description
I am using this type of code useEffect(() => { let locationTimeout: NodeJS.Timeout | null = null
locationTimeout = setTimeout(() => {
if (!userLocation) {
showMessage("Please turn on your GPS.", "error", "Location required")
}
}, 5000)
Geolocation.getCurrentPosition(
(position) => {
setUserLocation(position.coords)
if (locationTimeout) clearTimeout(locationTimeout)
},
(error) => {
console.info("[getUserLocation] ERROR - ", error)
showMessage(
"Please check your permissions and your GPS connection.",
"error",
"Couldn't retrieve your location",
)
setUserLocation(null)
if (locationTimeout) clearTimeout(locationTimeout)
},
{ enableHighAccuracy: false, timeout: 20000, maximumAge: 20000 },
)
return () => {
if (locationTimeout) clearTimeout(locationTimeout)
}
}, [])