apache / apache/cordova-plugin-geolocation

Expected behavior from watchPosition timeouts and high accuracy

Open
#287 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
646
Forks
654
PR merge metrics
No merged PRs in 30d

Description

I am testing some new rewrites of my code for geolocation and am noticing some peculiliar things and hoping others can help explain.

For both getCurrentPositions() and watchPosition() I use same following options:
`var geoOptions = { maximumAge: 10000, timeout: 10000, enableHighAccuracy: true };`

1. When app is deployed to iOS Simulator and physical iPhone the `watchPosition()` fires a 4 times (every time) and then on the 4th call I get a timeout which is triggers my onError callback. The specific error message is `Code: 3, Message: Position retrieval timed out`. After 1 timeout, watchPosition() stops and does not resume. This happens on fresh install of app on either type and with simply deploying the app again (overwriting the current installed one. On physical devices and Android simulator this is not happening - I see it firing about once per second (***) continuously.

2. When deployed a real device, watchPosition() seems to be firing every second even though my device is plugged and sitting on and not moving. How exactly is watchPosition working? I assume it would only trigger if it detected an actual movement, but my debugging shows the same coordinates every time it fires.

3. Is there a way to slow down the watchPosition to only "check" once per 10 seconds...I don't need extreme "watching" in my app but I do need to try and update the users coordinates at certain intervals.

4. Last, how intensive is `enableHighAccuracy` on the device as well as what are others experiences when not using it - the disabledHIghAccuraccy coordinates versus the enableHighAccurracy coordinates? Is there really a significant difference?

Thanks.

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported watchPosition behavior on the iOS Simulator, physical iPhone, and Android using maximumAge 10000, timeout 10000, and enableHighAccuracy true. Compare callback frequency, repeated coordinates, timeout handling, and high-accuracy behavior; done means the platform differences and a supported way to control update intervals are documented or confirmed.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, ios, javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.