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

Geolocation.prototype.watchPosition uses timeout option in wrong way

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • 1.8.0
    • cordova-ios
    • None

    Description

      reported at: https://github.com/phonegap/phonegap-iphone/issues/305
      by: https://github.com/all4ip

      I have following scenario:

      I want aprox. every second a position update. I do not want cached positions. I am willing to wait up to 30 seconds for the first valid position.

      So my params would be:
      var options =

      { timeout: 30000, maximumAge: 0, enableHighAccuracy: true }

      ;

      This is identical to w3c definition.

      But the timout value is also used for the internal endless loop of watchPosition. So I can either have updates every second and can wait up to 1 second for valid position or wait up to 30 seconds for valid position and get updates only every 30 seconds, too!

      The timout option should be used like the doc says:

      "The maximum length of time (msec) that is allowed to pass from the call to geolocation.getCurrentPosition or geolocation.watchPosition until the corresponding geolocationSuccess callback is invoked."

      This happens correctly, when the params are passed to getCurrentPosition().

      But the continuous update in watchPosition uses the same value for the timer, too:

      setInterval(intervalFunction, params.timeout);

      The interval should be a static value i.e. 1000 ms or 500 ms or a variable frequency.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              shazron Shazron Abdullah
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: