title: Behaviour for significant change location API when terminated/suspended?
body: <p>This is the section from the <a href="http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html" rel="noreferrer">CLLocationManager</a> documentation describing the app behavior with <a href="http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/instm/CLLocationManager/startMonitoringSignificantLocationChanges" rel="noreferrer">startMonitoringSignificantLocationChanges</a>:</p>
  
  <blockquote>
    <p>If you start this service and your
    application is subsequently
    terminated, the system automatically
    relaunches the application into the
    background if a new event arrives. In
    such a case, the options dictionary
    passed to the
    application:didFinishLaunchingWithOptions:
    method of your application delegate
    contains the key
    UIApplicationLaunchOptionsLocationKey
    to indicate that your application was
    launched because of a location event.
    Upon relaunch, you must still
    configure a location manager object
    and call this method to continue
    receiving location events. When you
    restart location services, the current
    event is delivered to your delegate
    immediately. In addition, the location
    property of your location manager
    object is populated with the most
    recent location object even before you
    start location services.</p>
  </blockquote>
  
  <p>So my understanding is that if your app terminates (and I assume if you don't call <a href="http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/instm/CLLocationManager/stopMonitoringSignificantLocationChanges" rel="noreferrer">stopMonitoringSignificantLocationChanges</a> from <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/applicationWillTerminate:" rel="noreferrer">applicationWillTerminate</a>) you will get woken up with a <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/c/data/UIApplicationLaunchOptionsLocationKey" rel="noreferrer">UIApplicationLaunchOptionsLocationKey</a> parameter to <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/application:didFinishLaunchingWithOptions:" rel="noreferrer">application:didFinishLaunchingWithOptions</a>. At that point you create your <a href="http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html" rel="noreferrer">CLLocationManager</a>, call <a href="http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/instm/CLLocationManager/startMonitoringSignificantLocationChanges" rel="noreferrer">startMonitoringSignificantLocationChanges</a> and do your background location processing for a <a href="http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html#//apple_ref/doc/uid/TP40009497-CH2-SW8" rel="noreferrer">limited time</a>.  So I am fine with this bit.</p>
  
  <p>The previous paragraph only talks about what happens when the app is terminated, it doesn't suggest what you do when the application is suspended.  The documentation for <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/application:didFinishLaunchingWithOptions:" rel="noreferrer">didFinishLaunchingWithOptions</a> says:</p>
  
  <blockquote>
    <p>The application tracks location
    updates in the background, was purged,
    and has now been relaunched. In this
    case, the dictionary contains a key
    indicating that the application was
    relaunched because of a new location
    event.</p>
  </blockquote>
  
  <p>Suggesting that you will only receive this call when your app is launched (because of a location change) after you have been terminated.</p>
  
  <p>However the paragraph on the <a href="http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html#//apple_ref/doc/uid/TP40009497-CH2-SW8" rel="noreferrer">Significant Change Service</a> in the <a href="http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html" rel="noreferrer">Location Awareness Programming Guide</a> has the following to say:</p>
  
  <blockquote>
    <p>If you leave this service running and
    your application is subsequently
    suspended or terminated, the service
    automatically wakes up your
    application when new location data
    arrives. At wake-up time, your
    application is put into the background
    and given a small amount of time to
    process the location data. Because
    your application is in the background,
    it should do minimal work and avoid
    any tasks (such as querying the
    network) that might prevent it from
    returning before the allocated time
    expires. If it does not, your
    application may be terminated.</p>
  </blockquote>
  
  <p>This suggests you are woken up with location data if your app has been suspended, but fails to mention how you are woken up:</p>
  
  <ul>
  <li>Does the <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UIApplicationDelegate" rel="noreferrer">UIApplicationDelegate</a> get a callback telling me that I am resuming from a suspended state into a background state?</li>
  <li>Does the location manager (that was freeze dried when the app was suspended) start receiving <a href="http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocationManagerDelegate_Protocol/CLLocationManagerDelegate/CLLocationManagerDelegate.html#//apple_ref/occ/intfm/CLLocationManagerDelegate/locationManager:didUpdateToLocation:fromLocation:" rel="noreferrer">locationManager:didUpdateToLocation:fromLocation</a> callbacks? </li>
  <li>Do I just need to implement code in my <a href="http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocationManagerDelegate_Protocol/CLLocationManagerDelegate/CLLocationManagerDelegate.html#//apple_ref/occ/intfm/CLLocationManagerDelegate/locationManager:didUpdateToLocation:fromLocation:" rel="noreferrer">didUpdateToLocation</a> message which checks the application state and does minimal processing if in background mode? </li>
  </ul>
  
  <p>In the process of writing this up, I think I may have just answered my own question, but it would be great to have my understanding of this confirmed by someone more knowledgeable.</p>