2
navigator.geolocation.getCurrentPosition(
        (position) => console.log(position),
        (error) =>console.log(error),
        { enableHighAccuracy: true, timeout: 20000, maximumAge: 10000 });

and I have add already but still not working

Song Huyse
  • 21
  • 2
  • What is the error your getting? have u included all the permissions especially android API > 23 requires ACCESS_FINE_LOCATION permission using the PermissionsAndroid API. Check React-Native docs. – Ravi Raj Dec 05 '17 at 11:11
  • Yes I already did it but I still got a message "No location provider available.", code: 1 – Song Huyse Dec 06 '17 at 01:44

1 Answers1

3

I have been getting the same error on physical device (android). I noticed GPS was disabled then. After turning the GPS on, I did not get this error anymore and got the current position in callback. Hope it helps.
In case, you want to prompt the user to enable the GPS if it is not, there is a good answer on stackoverflow : react-native check and promp user to enable Network/GPS

Chandan Kumar
  • 105
  • 1
  • 8
  • Thank for your answer but when I use geolocation it's not response latitude and longitude when callback especially with real device version 6 up. My solution is write own native code and it works fine for now – Song Huyse Feb 13 '18 at 08:37