locationManager didUpdateLocations stops updating when phone is still

I built an autopilot for my boat, and took it further by writing an IOS app to control it via bluetooth with my phone. Everything was working great, until I thought I'd add the ability to navigate a route. Here's what has me stumped...

I've got location manager generating updates, as long as the phone is moving (ever so slightly) in my hand. I've got the display setup to never sleep, and the phone is plugged in to power. If I put the phone down, I get a few new locations, then the location freezes. The didUpdateLocations delegate is called, but the location never changes.

I've tried a number of settings but no matter what I try, none have solved the still phone issue. My current design uses

self.locationManager?.requestLocation()

sent on at programmable interval, so that I get updates with reasonable spacing. The updates come, but the location is identical if the phone is still (laying on the dash of the boat). If I just "wiggle" the phone a bit, locations come with a new value. If I keep "wiggling the phone, I get new locations every call to requestLocation.

Seems like there is some kind of inactivity timer associated with didUpdataLocations that prevents retrieving new locations. It just re-sends the previous location.

This issue has nothing to do with using requestLocation, since I had the same issue when didUpdateLocations was running on its own timing. I added the code and logic to support requestLocation in an attempt to force a new location.

Has anyone experienced this or have any idea how to force a "new" location when the phone is still?

I'm using Xcode Version 14.3.1 (14E300c) The phone is an iPhone 12 and the deployment target is set to 15.3

Here's how I currently configure location manager... This is one of a number of attempts, but all have the same issue.

        if locationManager == nil{
            print("****** instantiating locationManager ******")
            locationManager = CLLocationManager()
            locationManager!.distanceFilter = kCLDistanceFilterNone
//            locationManager!.distanceFilter = 3
            locationManager!.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
            locationManager!.delegate = self
            locationManager!.showsBackgroundLocationIndicator = true
            locationManager!.startUpdatingLocation()
            locationManager!.startUpdatingHeading()
            locationManager!.allowsBackgroundLocationUpdates = true
        }
    }
  • I should mention this only happens when the boat is moving very slow, say around 1.5mph. Not sure what speed kicks it out of this mode, but at 30mph I get continuous updates.

Add a Comment

Replies

Did some additional testing in a car at slow speed. Turns out the updates with varying locations work down to about 2mph. Below 2mph, updates continue and accuracy is updated, but the location never changes. This went on for over 100'. This makes the location unusable for trolling speeds or a more critical application such as an anchor monitor.

It seems the issue is down to location's not updating when the speed is below 2mph.

Like sitting still on the bench, I could still make the locations change by "wiggling" the phone when the car was traveling below 2mpg.

  • Is anyone looking at this?

Add a Comment