Thank you all for your support and feedback.
I've made a lot of tests with IOS versions < 16.4 and IOS versions >= 16.4
The conclusion today is that the best solution was given by Gualtier Malde in this thread, but with one exception: distanceFilter must not be set ONLY (set it to kCLDistanceFilterNone leads to a non-deterministic behavior in 16.4 and upper versions, and stops the location updates or send updates completely erratically.
So with the below code, the location updates in background with IOS > 16.4 work for roughly 5h. After that, it's a mystery why it stops. The debugger spits out nothing ....
allowsBackgroundLocationUpdates must be set to TRUE
distanceFilter must not be set
desiredAccuracy must be kCLLocationAccuracyHundredMeters or better. If you’re using numeric values, it must be set to less than 1000 meters (in my case it's 30 meters)
showsBackgroundLocationIndicator to TRUE (when I set it to false ou not set, the behavior got worse)
My app's code now tests which IOS version the device runs and I remove distanceFilter when > 16.4. In the locationManager I also send updates to my backed only every 30s because IOS 16.4 ignores Timer.scheduledTimer ...
At this point of time, I don't know how to do better. I just updated my phone to 16.5 and will run some tests with this version but no hope.
It's a shame that with IOS 14.x it works so well ...
If someone has the magic solution, please share.
Topic:
App & System Services
SubTopic:
Maps & Location
Tags: