I am trying to use HMTL5 GeoLocation in Android emulator. Riht now I am trying a basic code to make it work on Android emulator. Here is that code
if(!navigator.geolocation) {
alert("Your browser does not supporty geolocation");
} else {
navigator.geolocation.getCurrentPosition(success, error);
}
function success(position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
alert(lat + ", " + lng);
}
function error(error) {
alert("Error occurred " + error);
}
Now when I run this code on Chrome on PC then it works fine. But when I run this code on Android Emulator then it shows this error
Error Occurred [objectPositionError]
How can I make it work on Android emulator?
In Chrome 50, mobile or desktop, they have stopped allowing geolocation to non-secure websites. https://developers.google.com/web/updates/2016/04/geolocation-on-secure-contexts-only?hl=en
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.