I'm trying to use navigator.geolocation.getCurrentPosition
on my Android device (Philips Xenium). It works absolutely ok in iphone and genimotion simulator.navigator.geolocation.getCurrentPosition
returns absolutely nothing - no errors, no success.
However, if I turn off geolocation service in my smartphone, it returns No available location provider
.
Also, navigator.geolocation.watchPosition
works fine.
Add the following permission to your AndroidManifest.xml file
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
and then pass an enableHighAccuracy object to your your geolocation.getCurrentPosition method:
navigator.geolocation.getCurrentPosition(
{enableHighAccuracy: true, timeout: 20000, maximumAge: 1000}
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With