I am having some difficulties with the Geolocation API in Javascript. It works very well in the following cases:
- On a PC with Chrome, Opera and Safari (not tested with IE)
- On Windows Mobile phone with IE
- On Android mobile with Opera (not tested on an iPhone)
But it is not working with Firefox on PC and especially with the default browser on Android. I have a Samsung Galaxy S LC (equivalent to Galaxy S1)
Here is my code (standard API Geoloc):
- On a PC with Chrome, Opera and Safari (not tested with IE)
- On Windows Mobile phone with IE
- On Android mobile with Opera (not tested on an iPhone)
But it is not working with Firefox on PC and especially with the default browser on Android. I have a Samsung Galaxy S LC (equivalent to Galaxy S1)
Here is my code (standard API Geoloc):
<body>We need your location.<script type="text/javascript">// attempting to retrieve the GPS locationdocument.write("Trying to retrieve your location");if(navigator.geolocation){document.write("Geolocation is supported");navigator.geolocation.getCurrentPosition(successCallback, errorCallback,{enableHighAccuracy : true,timeout : 5000,maximumAge : 0});function successCallback(position){document.write("You have been located. Latitude : " + position.coords.latitude +", longitude : " + position.coords.longitude);};function errorCallback(error){document.write("We coulnd't get your location");switch(error.code){case error.PERMISSION_DENIED:document.write("Permission Denied");break;case error.POSITION_UNAVAILABLE:document.write("Position unavailable");break;case error.TIMEOUT:document.write("Timeout");break;case error.UNKNOW_ERROR:document.write("Unknown error");break;}}}else{document.write("La géolocalisation n'est pas supportée par le navigateur");}</script></body>
What's going on with the Android default browser:
1. The following messages appear:
" Trying to retrieve your location "
"Geolocation is supported"
2. After the time specified by the timeout (10s here) the page becomes all white.
The functions sucessCallback or errorCallback are not called.
I then tried trough a Webview but it does the same.
Thank you very much for your help.
1. The following messages appear:
" Trying to retrieve your location "
"Geolocation is supported"
2. After the time specified by the timeout (10s here) the page becomes all white.
The functions sucessCallback or errorCallback are not called.
I then tried trough a Webview but it does the same.
Thank you very much for your help.
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment