Can mobile devices support Geolocate API v3?

52 views
Skip to first unread message

summerap

unread,
Apr 28, 2011, 3:30:58 AM4/28/11
to Google Maps JavaScript API v3
Regard the subject, I tried on the mini opera, android browser,
symbian browser, and Iphone browser.
Only the Iphone can support my geolocate google maps API v3. Can
somebody tell me why other cannot support it?
Thank you.

summerap

unread,
Apr 28, 2011, 3:34:02 AM4/28/11
to Google Maps JavaScript API v3
And I found that the geolocate sample code below provided by Google
also cannot work in mobile devices.

http://code.google.com/apis/maps/documentation/javascript/examples/map-geolocation.html

Pil

unread,
Apr 28, 2011, 5:19:35 AM4/28/11
to Google Maps JavaScript API v3
Different mobile vendors are doeing their own thing - like Google's
Chrome doesn't support the standardized Geolocation API yet but still
uses Gears instead.

The following library tries to combine geolocation support for the
most different mobile platforms plus desktop browsers - as far as I
know

http://code.google.com/p/geo-location-javascript/




On Apr 28, 9:34 am, summerap <summer_ap0...@hotmail.com> wrote:
> And I found that the geolocate sample code below provided by Google
> also cannot work in mobile devices.
>
> http://code.google.com/apis/maps/documentation/javascript/examples/ma...

summerap

unread,
Apr 28, 2011, 7:36:46 AM4/28/11
to Google Maps JavaScript API v3
// 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);
}


Why this geolocate sample code telling W3C is preferred?
Which is the most suitable to support mobile devices and also used for
desktop browser in the same time?

Pil

unread,
Apr 28, 2011, 8:14:28 AM4/28/11
to Google Maps JavaScript API v3


On Apr 28, 1:36 pm, summerap <summer_ap0...@hotmail.com> wrote:

> Why this geolocate sample code telling W3C is preferred?


Because this is the standard.


> Which is the most suitable to support mobile devices and also used for
> desktop browser in the same time?


Why don't you try it?

As I said: Different mobile vendors uses different devices, different
browsers uses either the standard Geolocation API, Gears or none of it
at all.

Reply all
Reply to author
Forward
0 new messages