Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restart locationUpates after pausesLocationUpdatesAutomatically [CLLocationManager]

I am wondering if iOS system restarts locationUpdates of CLLocationManager automatically after being paused automatically by the pausesLocationUpdatesAutomatically property or if I have to handle the case by my own.

If yes, according to which rules and if not how to know that I start moving again and should relaunch locationUpdates ?

like image 272
kokluch Avatar asked Jan 24 '14 14:01

kokluch


1 Answers

If you set

yourLocationManager.pausesLocationUpdatesAutomatically = YES;

you should also set a value to

yourLocationManager.activityType

"The location manager uses the information in this property as a cue to determine when location updates may be automatically paused. Pausing updates gives the system the opportunity to save power in situations where the user's location is not likely to be changing. For example, if the activity type is CLActivityTypeAutomotiveNavigation and no location changes have occurred recently, the radios might be powered down until movement is detected again."

UPDATE: changed Apple documentation " After a pause occurs, it is your responsibility to restart location services again when you determine that they are needed. Core Location calls the locationManagerDidPauseLocationUpdates(_:) method of your location manager's delegate to let you know that a pause has occurred. In that method, you might configure a local notification whose trigger is of type UNLocationNotificationTrigger and is set to notify when the user exits the current region. The message for the local notification should prompt the user to launch your app again so that it can resume updates."

like image 68
tanzolone Avatar answered Oct 19 '22 12:10

tanzolone