Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13604

Returned location coordinates are very inaccurate after requesting location for a period of time while not connected to wifi

    XMLWordPrintableJSON

Details

    Description

      While requesting a location every 10 seconds using an interval, I consistently see the accuracy of returned positions suddenly jump to several kilometers. The lat/long of each location request in my App is saved to an external database and is then used to update the marker position on a web based Google Map. At first the marker is in exactly the right place then after several minutes it becomes wildly inaccurate.

      To debug this I saved the accuracy of each location request to an array and each time I tested, the accuracy began at around 10-65 metres then jumped to around 2km on Android and over 10km on iOS after around 6-7 minutes consistently. The returned coordinates continue to be very inaccurate for several minutes and then return to between 10-65 metres.

      Here is a subset of the location accuracy array on iOS when the issue is present, each line is the returned accuracy in metres; 10 seconds apart:

      [
      65,
      65,
      65,
      65,
      10079,
      10079,
      10079,
      10079
      ]

      As far as I can tell, this issue is only present when the device is not connected to a wifi network. I can reproduce this behaviour on both iOS and Android, while inside and stationary, and while travelling on foot with line of sight to the sky. I have ensured the app remains in the foreground while testing and the device/screen is awake. I make no changes to the App or device when the accuracy decreases.

      I have tried with and without enableHighAccuracy enabled and the behaviour does not change. I have maximumAge set to zero and a timeout of 10000 milliseconds.

      I am using navigator.geolocation.getCurrentPosition for each request. watchPosition does not suit my purpose because I am only updating the database with returned coordinates every 10 seconds.

      Attachments

        Activity

          People

            Unassigned Unassigned
            remiappware Remi Boardman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: