Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are 2 options:</p> <p>One is the significant location changes service which John mentioned above. The other one is the <code>startRegionMonitoring</code></p> <p>Both are covered in the <a href="http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html" rel="nofollow">Location Awarness Documentation</a> From Apple</p> <p>Both can open an terminated (closed) app for a brief moment and you can deliver a local push notification to alert the user. The app cannot get in a normal state, but if the user clicks the notification the app will open, so you can achieve your goal.</p> <p>Here is a sample code on intercepting the event in the didFinishLaunchingWithOptions delegate and firing a local notification. Normally you should not fire the notification here, but rather reinitialize your location manager, get the new position and display the message (local notification) for the area the user did enter...</p> <pre><code> - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //see if application was launched from a location event! if ([launchOptions objectForKey:UIApplicationLaunchOptionsLocationKey]) { //if so, we need to reinitialize our location manager! [[LocationManager sharedLocationManager] startSignificantLocationMonitoring]; //fire a notification UILocalNotification *notification = [[UILocalNotification alloc] init]; notification.fireDate = [NSDate date]; NSTimeZone* timezone = [NSTimeZone defaultTimeZone]; notification.timeZone = timezone; notification.alertBody = @"app did wake up"; notification.alertAction = @"OK"; notification.soundName = @"yes.caf"; [[UIApplication sharedApplication] scheduleLocalNotification:notification]; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload