rolinger opened a new issue, #288:
URL: https://github.com/apache/cordova-plugin-geolocation/issues/288

   # Bug Report
    On iOS, when the watchPosition() function times out it causes the 
watchPosition() to just stop working.  It won't continue or restart.
   
   ## Problem
   Why the timeout is occurring in the first place is its own debate, but these 
are the behaviors I am **consistently** seeing, regardless of iOS device type 
(various iPhones) or various simulators - its consistent across all.
   
   1. When there is a timeout, watchPosition() triggers its onError and will 
not continue, it just stops.  And when I mean stop, I mean its not `cleared` 
(as with clearWatch()), but rather it just stops reporting.  The watchID still 
shows the original instanceID of when `var watchID = 
navigator.geolocation.watchPosition(onSuccess,onError,options) ;` was called 
the first time.  
   
   2. Upon start up, watchPosition() will call three times successfully, and on 
the 4th it will fail.  I added code to clear the existing ID and restart the 
watchPosition() method after each onError timeout.  Then _EVERY_ time after 
that if times out after 2 successful calls - it timesout on the 3rd call after 
each watchPosition() restart
   
   3.  I increased the option {timeout: 30000} which had no affect - it just 
took longer to finally time out.  The relevance of this is that a 3 second or 
30 second time out before calling onError has no affect on behavior - its all 
the same.
   
   ### What is expected to happen?
   Regardless of a timeout, the watchPosition() should continue monitoring 
location/movement changes.
   
   
   ### What does actually happen?
   Mentioned above
   
   
   ## Information
   I found this thread regarding this same issue and I think they are right: 
https://stackoverflow.com/questions/30989428/apache-cordova-geolocation-watchposition-times-out-on-ios-when-standing-still
   
   My iPhone sits on my desk as I deploy my app to it to test - so its not 
moving.  So after reading the above Stack thread I picked the phone up off my 
desk, while still connected to my Mac, and began waving the phone around.  Well 
sure as heck, the watchPosition() started firing every second with a slightly 
different lat/lon coordinate being reports....it fired 10 to 15 times before I 
put it back down on my desk...4 or 5 watchPosition() onSuccess's later, the 
phones gps settled down and started reporting the same lat/lon coordinates 
again - by the 3rd one, it timed out again.   Its hard to get it trigger 
onSuccess again, because apparently the `distanceFilter` as mentioned in the 
thread only reports a change of more than 5 meters - thats 15+ ft!!!  Aside 
from writing special code to send gps logging to the server, most people don't 
have a 20ft iPhone cable that is going to be long enough to consistently 
trigger onSuccess change back to their connected Mac
   
   This tells me there are two problems.  
   1) **Needs a Solution:** The timeout is happening due to `distanceFilter` 
not changing after two or three reporting cycles.  It seems the 
`distanceFilter` is thinking since there is no change then there is nothing to 
report...with nothing to report, watchPosition() times out.  The solution is 
possibly the one suggested in the thread
   
   2) **A Bug**: When the timeout does happen it is somehow freezing 
watchPosition()...its not clearing it or closing it....it just stops..  The 
behavior should be that it continues to monitor any changes in the devices 
coordinates without having to be restarted again.
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   
   
   ### Environment, Platform, Device
   Cordova 12
   cordova-ios 7.1.1
   Xcode 16.2
   cordova-plugin-geolocation v5.0.0
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [ x] I searched for existing GitHub issues
   - [x ] I updated all Cordova tooling to most recent version
   - [ x] I included all the necessary information above
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to