I've recently started messing around with core-location so my knowledge my not be bullet-proof.
If the app is is still active but only in the background then as long as you set the allowsBackgroundLocationUpdates
to true
then you will get updates. But this could become battery consuming, it could go on until your battery dies.
You may want to avoid constant location checking by setting:
pausesLocationUpdatesAutomatically
to true
.
However if you do set it to true
then if your driver stops at a location for too long(I don't know what means too long) then the app would stop completely from tracking location until you bring the app to foreground again. I'm saying that based on:
Important For apps that have in-use authorization, a pause to location
updates while in the background ends access to location updates until
the app returns to the foreground and is able to restart location
services. If you do not wish location updates to stop entirely,
consider disabling this property and changing location accuracy to
kCLLocationAccuracyThreeKilometers when your app moves to the
background. Doing so allows you to continue receiving location updates
in a power-friendly manner.
So it's a little tricky. You may want to set pausesLocationUpdatesAutomatically
to true but then if your business requirements allow...do something like stopUpdatingLocation()
after 1hr of app being in background to stop location updates completely.