Location Updates

Calling the StartUpdatingLocation method causes the location manager to obtain an initial location fix (which may take several seconds) and notify your delegate by calling its DidUpdateLocations method. After that, the receiver generates update events primarily when the value in the distanceFilter property is exceeded. Updates may be delivered in other situations though. For example, the receiver may send another notification if the hardware gathers a more accurate location reading.

Calling this method several times in succession does not automatically result in new events being generated. Calling StopUpdatingLocation in between, however, does cause a new initial event to be sent the next time you call this method.

If you start this service and your app is suspended, the system stops the delivery of events until your app starts running again (either in the foreground or background). If your app is terminated, the delivery of new location events stops altogether. Therefore, if your app needs to receive location events while in the background, it must include the UIBackgroundModes key (with the location value) in its Info.plist file.

In addition to your delegate object implementing the DidUpdateLocations method, it should also implement the DidFailWithError method to respond to potential errors.

using SA.iOS.CoreLocation;


Call StopUpdatingLocation method whenever your code no longer needs to receive location-related events. Disabling event delivery gives the receiver the option of disabling the appropriate hardware (and thereby saving power) when no clients need location data. You can always restart the generation of location updates by calling the StartUpdatingLocation method again.

using SA.iOS.CoreLocation;


Request Location

Calling the RequestLocation method causes the location manager to obtain a location fix (which may take several seconds) and call the delegate’s DidUpdateLocations method with the result. The location fix is obtained at the accuracy level indicated by the DesiredAccuracyproperty. Only one location fix is reported to the delegate, after which location services are stopped. If a location fix cannot be determined in a timely manner, the location manager calls the delegate’s DidFailWithError method instead and reports a kCLErrorLocationUnknown error.

Use this method when you want the user’s current location but do not need to leave location services running. This method starts location services long enough to return a result or report an error and then stops them again. Calling the StopUpdatingLocation method cancels any pending request made using this method. Calling this method while location services are already running does nothing. To cancel a pending request, call the StopUpdatingLocation method.

If obtaining the desired accuracy would take too long, the location manager delivers a less accurate location value rather than reporting an error.

When using this method, the associated delegate must set using the SetDelegate method. Failure to do so is a programmer error.

Pause Location Updates

PausesLocationUpdatesAutomatically value indicating whether the location manager object may pause location updates. 

Allowing the location manager to pause updates can improve battery life on the target device without sacrificing location data. When this property is set to true, the location manager pauses updates (and powers down the appropriate hardware) at times when the location data is unlikely to change. For example, if the user stops for food while using a navigation app, the location manager might pause updates for a period of time.

After a pause occurs, it is your responsibility to restart location services again when you determine that they are needed. Core Location calls the DidPauseLocationUpdates method of your location manager's delegate to let you know that a pause has occurred.

Warnign: For apps that have in-use authorization, a pause to location updates ends access to location changes until the app is launched again and able to restart those updates. If you do not wish location updates to stop entirely, consider disabling this property and changing location accuracy to ThreeKilometers when your app moves to the background. Doing so allows you to continue receiving location updates in a power-friendly manner.

The default value of this property is true. You may chnage value to false, but that most likely will reduse battery life while your application is in use.

using SA.iOS.CoreLocation;

ISN_CLLocationManager.PausesLocationUpdatesAutomatically = false;