3

I'm testing an app that uses startMonitoringSignificantLocationChanges on a 3GS with IOS 4.01 (I want my app to work in any version of IOS4 so I haven't upgraded the OS on this device).

info.pllist has a "registered for location updates" background key (not needed for startMonitoringSignificantLocationChanges but needed elsewhere in the app).

I found out that if the device is in sleep mode and my app is in the background, significant location updates are not triggered even if I travel for a long distance (passing through quite a few cell towers) and a long time. But as soon as I press the Home key to wake up the device (with my app still in the background, nothing in the foreground) - the location event handler in my app gets triggered with a valid location for that area (I can verify that this is a significant location event by checking the accuracy which is well over 1000 meters).

This defies the whole idea of monitoring significant location changes, because users do not travel with their devices in active state.

Unfortunately I don't have a device with a more advanced OS to check this (all my other devices are not iPhones and they do not support startMonitoringSignificantLocationChanges).

Is this a know issue or am I doing something wrong?

Amiram Stark
  • 2,208
  • 22
  • 32

2 Answers2

0

Have you looked through this question and its answers on a similar topic?

It's hard to tell without seeing your code, but maybe there's something missing in your implementation of the background behavior?

Community
  • 1
  • 1
Kristofer Sommestad
  • 3,061
  • 27
  • 39
0

You need to make sure your AppDelegate is set up as the CLLocationManagerDelegate and have the correct methods set to receive the callbacks when the significant change is fired. If you have a different class set up as the delegate and your app goes to the background... chances are that class won't get woke up to receive them.

Try setting your AppDelegate to receive them... then call out to your class for any work you need done.

Bill Burgess
  • 14,054
  • 6
  • 49
  • 86
  • Thanks, but as I said my AppDelegate DOES get called - but only when I press the Home key to take the device out of sleep mode. As soon as I press this button, with my app still in the background, my app delegate receives a significant location notification, even though it is still in the background. I use detailed logging in my app delegate and I know exactly what happens when. There are no location events whatsoever while the display is turned off. I even added a timer event to make sure that my app is still alive and kicking in the background, and the timer delegate does get called. – Amiram Stark Oct 17 '11 at 22:29