i am developing an application for iphone using iOS 4.2 SDK.
My application need to popup an alert when a user arrives a specific location (in 400m radius). Note that I need to get this alert even if the app is in the
background.
When I use the locationManager with
startUpdatingLocation mode,
开发者_如何转开发i get the alert when the app is in the foreground, but not when it is in the background.
When I try to run with locationManager with
startMonitoringSignificantChanges mode, i don't get any position changes in background and even not in foreground (i.e. didUpdateLocation method is never called. only once in the application start up)
some facts:
1. I updated info.plist with UIBackgroundMode with 'location' as first item in array.
2. I updated info.plist UIDeviceCapabilities with gps and location-services (though it doesn't really matters)
3. all said above refers to running this app on the 3GS iphone device.
4. I tried this app on sdk 4.0 and 4.1 and got the same problem.
5. The device supports startMonitoringSignificantChanges use (method of locationManager confirms it)
6. When I check the app on the device i move in range of ~150 meters meters. Is the startMonitoringSignificantChanges will call didUpdateLocation method with this kind of movement?
7. All settings on the devices are turned to on mode (roaming, 3G, wifi,...)
Am i missing something? any ideas?
Thanks,
if you're still interested, have a look at that post:
Behaviour for significant change location API when terminated/suspended?
and the example project mentioned:
http://www.cannonade.net/blog.php?id=1480
精彩评论