cordova geolocation google map

11 views
Skip to first unread message

couleurs AFRIK

unread,
Oct 13, 2016, 11:04:25 AM10/13/16
to phonegap
Hi,
I try to use geolocation google map with cordova , in my device have this error code 3 timeout expired, but any error in the console and the map don't display.
that's is my code:

  <script type="text/javascript">
navigator.geolocation.getCurrentPosition(onSuccess, onError, { timeout: 150000});
function onSuccess(position) {
var lat=position.coords.latitude;
var lang=position.coords.longitude;
//alert("Latitude : " + lat + " Longitude: " + lang);
//Google Maps
var myLatlng = new google.maps.LatLng(lat,lang);
var mapOptions = {zoom: 4,center: myLatlng}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var marker = new google.maps.Marker({position: myLatlng,map: map});
}
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
google.maps.event.addDomListener(window, 'load', onSuccess);

</script>

i need help , thanks
Reply all
Reply to author
Forward
0 new messages