简体   繁体   中英

Should iOS Significant Location Change wake up my app after restarting a *locked* phone?

I am building an app that uses the significant change API. Everything works fine except in a very specific case:

If the user's phone is locked, and the user restarts the phone, then the Significant Location Change API will wake up the phone in the first few minutes and make a call to

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations

All good, but at this point, if the user has yet to unlock their phone , the Significant Location Change will make no further attempts to wake up the app, even if I subsequently unlock the phone. Essentially, Significant Location Change monitoring gets turned off.

NB that if I unlock (and re-lock) the phone before the SLC wakes up my app, then it will continue to wake up my app with any subsequent location changes.

My question is: is this really the expected behaviour? Can anyone point me to documentation about the behaviour of the SLC API when the phone is locked, and specifically when the phone is locked and the device is restarted?

The app does get launched in the background upon significant location change. I just had a trip to test that.

Upon significant location change I do a local push notification which appears after a significant location change, even when the phone is locked .

I am yet to test what happens after 10 minutes, the device is locked, and a significant location change occurs.

I am experiencing the same issue (iOS8.1.1 / iPhone 5)-

I am successfully using significant location change monitoring in my app.

SCENARIO 1) After the phone boots, if I immediately unlock the phone, my app is restarted with UIApplicationLaunchOptionsLocationKey in didFinishLaunchingWithOptions.

SCENARIO 2) However, if I wait > 3 minutes to unlock the phone after boot, the app does not restart. If I take my phone for a walk, my app does not restart.

When checking the phone debug output, I noticed that life360 and facebook both DO start significant location change in SCENARIO 2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM