title: HTML5 geolocation - not working on Android
body: <p>The project I'm working on uses smartphones with Android (can't tell what version but it's recent) to find the user's current position. However, at the moment, it brings up the "share current position" allow/reject question, but then does nothing. If you leave it on that then the page in the background reloads after a bit, and if you allow it then it reloads in any case. It should bring up the location in a message prompt.</p>
  
  <p>I will point out that this works on an iPhone I've had access to, and in IE10 (I think it is).</p>
  
  <pre><code>&lt;asp:Button ID="btnLocate" Text="Loc" OnClientClick="return GetLocation()" runat="server" /&gt;
  
  &lt;script type="text/javascript"&gt;
  
              function GetLocation()
              {
                  if (navigator.geolocation)
                  {
                      navigator.geolocation.getCurrentPosition(ShowPosition, ShowError, { enableHighAccuracy: true, timeout: 31000, maximumAge: 90000 });
                  }
                  else{alert("Geolocation is not supported by this browser.");}
              }
              function ShowPosition(position)
              {
                  alert(position.coords.latitude + "," + position.coords.longitude);
                  return false;
              }
              function ShowError(error)
              {
                  switch(error.code) 
                  {
                      case error.PERMISSION_DENIED:
                          alert("User denied the request for Geolocation.");
                          break;
                      case error.POSITION_UNAVAILABLE:
                          alert("Location information is unavailable.");
                          break;
                      case error.TIMEOUT:
                          alert("The request to get user location timed out.");
                          break;
                      case error.UNKNOWN_ERROR:
                          alert("An unknown error occurred.");
                          break;
                  }
              }
          &lt;/script&gt;
  </code></pre>
  
  <p>I should also mention that GPS is enabled and Google Maps is able to find the location just-about instantly.</p>