I am working with an app for tracking driving activity. Currently, I have code that combines CLLocationManager location updates with motion data from CMMotionActivityManager.
My codebase is not straightforward and requires manual starts/stops, etc. After watching the WWDC session about CLLocationUpdate.liveUpdates (https://developer.apple.com/wwdc23/10180) with the specific LiveConfiguration.automotiveNavigation, I thought it was exactly what I needed. Moreover, the presenter mentioned that it could simplify code and remove the dependency on CMMotionActivityManager.
I downloaded the demo project from here https://developer.apple.com/documentation/corelocation/adopting-live-updates-in-core-location, adapted it for iOS 17, and changed CLLocationUpdate.liveUpdates() to CLLocationUpdate.liveUpdates(.automotiveNavigation). However, the result was not what I expected. I received location updates after waking from a stationary state by lightly touching the device, which is not "automotive." Additionally, the changes to LiveConfiguration do not seem to affect the behavior.
What did I do wrong? Or what is the point of LiveConfiguration that I missed?
Thanks,
Like @staninprague said, the activity types are used to fine tune CoreLocation to give you location updates more accurate for your specific use case - for example .automotive
will correct the randomness in the location coordinates by moving them towards roads, because you have declared you are in an automobile.
These activity types do not mean only give me locations if the device is moving in a way that fits the activity type I declared.
So, the behavior you are seeing is expected.
Argun Tekant / DTS Engineer / Core Technologies