Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CLLocationManager management #106

Open
wants to merge 1 commit into
base: release
Choose a base branch
from

Conversation

noberasco
Copy link

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.

yarry pushed a commit to yarry/route-me that referenced this pull request Jul 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant