Android icon indicating copy to clipboard operation
Android copied to clipboard

[Bug] Geolocation doesn't work if Google Location Accuracy is disabled

Open danpla opened this issue 3 years ago • 1 comments

Describe the bug

Geolocation doesn't work if Google Location Accuracy is disabled. This is basically a continuation of #1658 , which does not recieve any feedback from the developers.

How to Reproduce

  1. Go to the system location settings and disable "Google Location Accuracy" (on Android 10 it can be found under the Advanced section.
  2. Go to maps.google.com and choose "Your location"

Expected behavior

It should work.

Environment

- DDG App Version: 5.154
- OS: Android 10

danpla avatar Apr 08 '23 19:04 danpla

Seems like it depends on webkit location impl and how it's done on web.

Here's a bit modified https://www.w3schools.com/html/tryit.asp?filename=tryhtml5_geolocation

<!DOCTYPE html>
<html>
<body>

<p>Click the button to get your coordinates.</p>

<button onclick="getLocation()">Try It</button>

<p id="demo"></p>

<script>
var x = document.getElementById("demo");

function getLocation() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition, error);
    x.innerHTML = "Loading";
  } else { 
    x.innerHTML = "Geolocation is not supported by this browser.";
  }
}

function showPosition(position) {
  x.innerHTML = "Latitude: " + position.coords.latitude + 
  "<br>Longitude: " + position.coords.longitude;
}

function error(err) {
  x.innerHTML = err.message;
}
</script>

</body>
</html>

In case of improved location turned off getCurrentPosition won't ever be finished. It happens in DDG, chromium (not Chrome) and other custom implemnetation based on webview as well.

Same flow works in Chrome and Firefox which uses Gecko inside.

Chrome also has some specific behavior since it's a google product. E.g. after fresh install it won't even ask location permission neither for app nor for site itself. For other web maps (e.g. komoot, yandex it will ask additional permission).

So this is not DDG bug but an overall webkit based implementations.

dryaz avatar Jun 03 '23 17:06 dryaz