kaiostech / sample-react

Simple example of a to-do list for KaiOS devices
https://developer.kaiostech.com/getting-started/build-your-first-app/sample-code#react
61 stars 22 forks source link

Geolocation with KaiOs terminals ERROR(3): Position acquisition timed out #15

Open Anoirwork opened 4 years ago

Anoirwork commented 4 years ago

Hi there Hope you guys doing well, So my issue is that whenever i ask for Geolocation either with navigator.geolocation.getCurrentPosition or watchPosition this gives me: 12:15:05.952 ERROR(3): Position acquisition timed out at error (app://1d1fe204-6982-4ccc-8ba3-710c339e27c9/index.html:38:3)1index.html:38:3 i've even removed the time out option , set it to more than 8000ms as some people on the net recommended it but still with no result i have also remove the enableHighAccuracy or set it to false an there was no expected result the permission is granted for sure here's my code.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="width=device-width,user-scalable=no,initial-scale=1"
    />
    <title>Hello World</title>
    <style>
      body {
        border: 1px solid black;
      }
    </style>
    <!-- Inline scripts are forbidden in Firefox OS apps (CSP restrictions),
         so we use a script file. -->
  </head>
  <body>
    <div id="demo"></div>
    <script type="text/javascript">
var options = { enableHighAccuracy: false, timeout: 2000, maximumAge: 1000 };
function success(pos) {
  var crd = pos.coords;
  console.log('Your current position is:');
  console.log(`Latitude : ${crd.latitude}`);
  console.log(`Longitude: ${crd.longitude}`);
  console.log(`More or less ${crd.accuracy} meters.`);
}
function error(err) {
  console.warn(`ERROR(${err.code}): ${err.message}`);
}
navigator.geolocation.getCurrentPosition(success, error, options);
    </script>
  </body>
</html>

PS: i have used the same instructions on the KaiOs tech developer guide for retiring the Geolocation data. Thanks for attention an help. https://ibb.co/y4m7gjY