Would be great if this app could show the user location from gps (for mobile
devices).
Im using this code to make this (outside this app)
function displayLocation(position){
var myLatLng = new google.maps.LatLng(position.coords.latitude,
position.coords.longitude);
if (! myMarker) {
// build entire marker first time thru
var image = new google.maps.MarkerImage('blue_dot_circle.png',
new google.maps.Size(38, 38), // size
new google.maps.Point(0, 0), // origin
new google.maps.Point(19, 19) // anchor
);
var shadow = '';
myMarker = new google.maps.Marker({
position: myLatLng,
map: map,
shadow: shadow,
icon: image,
title: 'I might be here'
});
} else {
// just change marker position on subsequent passes
myMarker.set_position(myLatLng);
}
// center map view on every pass
map.set_center(myLatLng);
//map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}
function handleError(error){
switch (error.code){
case error.PERMISSION_DENIED:
alert('Para ver el mapa debes aceptar la solicitud de localizacion.');
break;
case error.POSITION_UNAVAILABLE:
alert('Lo sentimos. No pudimos detectar tu ubicacion.');
break;
default:
alert('Codigo de Error: ' + error.code);
}
}
if (useragent.indexOf('iPhone') != -1 || useragent.indexOf('Android') != -1 ) {
// allow iPhone or Android to track movement
navigator.geolocation.watchPosition(displayLocation, handleError);
} else if (navigator.geolocation) {
// or let other geolocation capable browsers to get their static position
navigator.geolocation.getCurrentPosition(displayLocation, handleError);
}
im not the owner of the code, just using it...
hope it can be usefull to view this feature soon
Original issue reported on code.google.com by igna...@independiente.cl on 8 Aug 2011 at 2:24
Original issue reported on code.google.com by
igna...@independiente.cl
on 8 Aug 2011 at 2:24