android - Samsung Galaxy Devices can't use geolocation.getCurrentPosition -
ok, i've been looking adequate response issue quite time. have web application uses navigator.geolocation.getcurrentposition
user's position.
the native browser on samsung galaxy devices have problems getcurrentposition code. have tried kinds of variations of code callbacks , timeouts, same issue. plenty of people have documented issue, , indicate restarting device work (sometimes restarting work, not - , alert telling users restart device seems beyond rediculous).
has figured out surefire way use getcurrentposition work on samsung galaxy device? here's i'm working with...
<script> $(document).ready(function(){ if( navigator.geolocation ) { navigator.geolocation.getcurrentposition( success, fail ); } else { alert("sorry, browser not support geolocation services."); } function success(position) { window.location = "mobile_set_coordinates.php?user_lat=" + position.coords.latitude + "&user_lon=" + position.coords.longitude + "&accuracy=" + position.coords.accuracy; } function fail() { // not obtain location } }); </script>
also, here's link 1 of discussions regarding issue: https://groups.google.com/forum/#!topic/phonegap/esrhajfhgfu
i got same problem have few weeks ago. tried research 2 weeks on internet, solutions can find. after all, found out that:
- if google maps has never been open on target phone, function not work.
- reset gps state, restart phone. might help.
- if step 2 not work, reset state of gps, turn on time zone automatically on date time setting, restart phone.
according knowledge, there nothing wrong code. in fact, code same yours. happens not on galaxy devices on htc. faced problem on galaxy s2, galaxy note 2, htc nexus one, htc 1 x , htc incredible s. think should problem between android devices , competition of code somehow.
cheers,
Comments
Post a Comment