Skip to content

getCurrentPosition ignores maximumAge and returns stale locations #113

@rayneram

Description

@rayneram

Environment

  • Plugin version: 1.8.0
  • Platform: iOS
  • OS version: 11.4
  • Device manufacturer / model: iPhone 6S
  • Nativescript version: 4.1.0
  • Plugin config: See attached log file

Context

Plugin running in low-power mode (desiredAccuracy=1000) but occasionally needing to return an accurate, current position for the device. getCurrentPosition is being used to do this.

Expected Behavior

By providing a config of {timeout:60, maximumAge:5000, desiredAccuracy:100, samples:100} to getCurrentPosition, the method should return and persist a single location that is no older than 5 seconds and has an accuracy equal or better to 100m.

Actual Behavior

getCurrentPosition returns the first location that satisfied the desiredAccuracy parameter irrespective of maximumAge. This means it frequently returns the stale location which is provided initially by Location Manager and does not continue to wait for a more current one.

Debug logs

Attached log demonstrates this behaviour with a test app that calls getCurrentPosition every two minutes. On each occasion, the API returns an old location rather than waiting for Location Manager to provide a current one.

NSGL-Log1.txt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions