Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
there is a bug in Alpstein/route-me management of CLLocationManager.
Basically, if userTrackingMode is set to either RMUserTrackingModeFollow or RMUserTrackingModeFollowWithHeading, a CLLocationManager is instantiated to keep track of location changes.
So far so good.
However, if application is registered to get location updates in background, when application enters background mode, this location manager does not get deactivated, meaning that the GPS receives is kept active, draining the battery needlessly.
I'll explain better with an example. I have an application (EasyTrails, basically a GPS tracker) that is registered to receive location updates in background. However, I keep the location manager active in background only while the user is actually recording a track, otherwise the application will be sent to background just like any other application. Your use of CLLocationManager disrupts this behavior, since your instance of CLLocationManager does not get deactivated when application goes into background.
This pull request does just that: it registers with UIApplication status updates so that it can disable, if needed, the location manager when entering background mode and reenable it when application returns to foreground.