I have search for similar threads. Didn't find any solutions. I have a 
working app, but the geolocation does not work in Android. From what I'm 
reading iOS 4 and Android 2+ should be able to use navigator.geolocation . 
The script I implemented is the one below taken from the Google Maps v3 API. 
It works in iOS, and Chrome/Safari/Webkit on the desktop. For some reason it 
does not appear to work on Android phones (Tested 3 so far).

// Try W3C Geolocation (Preferred) 
  if(navigator.geolocation) { 
    browserSupportFlag = true; 
    navigator.geolocation.getCurrentPosition(function(position) { 
      initialLocation = new 
google.maps.LatLng(position.coords.latitude,position.coords.longitude); 
      map.setCenter(initialLocation); 
    }, function() { 
      handleNoGeolocation(browserSupportFlag); 
    }); 
  // Try Google Gears Geolocation 
  } else if (google.gears) { 
    browserSupportFlag = true; 
    var geo = google.gears.factory.create('beta.geolocation'); 
    geo.getCurrentPosition(function(position) { 
      initialLocation = new 
google.maps.LatLng(position.latitude,position.longitude); 
      map.setCenter(initialLocation); 
    }, function() { 
      handleNoGeoLocation(browserSupportFlag); 
    }); 
  // Browser doesn't support Geolocation 
  } else { 
    browserSupportFlag = false; 
    handleNoGeolocation(browserSupportFlag); 
  } 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to