Android : where to put enableHighAccuracy and other settings for geolocation

on Thursday, October 30, 2014


I have the following code which gets the geo location and posts it, then displays a button in div. This works on desktops but does not work in android a common issue as mentioned on this site. Recommendations are to add



{frequency:5000, maximumAge: 0, timeout: 100, enableHighAccuracy:true}


to the code below somewhere, I've tried a few places just stops it working, where do I put these values please?



function getCoordPosition() {

if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function (position) {
$.ajax({
type: "POST",
url: "{{path('login_log_location')}}",
data: {
latitude: position.coords.latitude,
longitude: position.coords.longitude
},
success: function () {
$("#divputinarea").html("{{path('login_log_yourarea')}}">
<button class="btn btn-large btn-primary">
Find your nearest matches</button>');
}

});
});
}

}

0 comments:

Post a Comment