tags:

views:

224

answers:

2

I was wondering if my code was broken, or if even a jailbroken (multitasking activated) iPhone 3g maybe doesn't support this.

I create a CLLocationManager, set the delegate and so on, and tell it to "startMonitoringSignificantLocationChanges". Whenever the app is then called, I log that to a textView. But nothing ever happens. Not if I drive 5km or 20km.

So I thought, well lets dig a little. I found this API: NSLog(@"Location Change Available: %i\n", [CLLocationManager significantLocationChangeMonitoringAvailable]);

Sadly it returns a zero :[

So, what I'm asking is: Did anyone get it to work on a 3g? Any hints? Impossible?

A: 

I tried this yesterday, got the same result. I have a jailbroken iPhone 3G running iOS4 with multitasking activated.

[CLLocationManager significantLocationChangeMonitoringAvailable] returns 0

If I use [manager startUpdatingLocation], it does work in the background, but it's using a lot of resources.

Nicu
Yeah, startUpdatingLocation uses GPS depending on the settings. And the GPS sucks a *lot* of power. :[Really sad. Guess that means I have to get a new device :/
+1  A: 

iOS4 brings two new background modes to Core Location: startMonitoringSignificantLocationChanges and startMonitoringForRegion:desiredAccuracy: using CLRegion.

The latter only works on the iPhone 4 device, likely due to new GPS hardware in the device. I confirmed this w/ an Apple rep on the Apple developer forums.

However, I have successfully tested startMonitoringSignificantLocationChanges on a 3GS. I have tested the same code on a jailbroken 3G as well as a vanilla 3G. I believe that simply the answer is that Apple has decided not to enable this feature on the 3G due to lack of resources.

When that feature is enabled, your program will be launched in the background when a significant location event occurs. This background multitasking may stretch the 3G to its limits (in Apple's eyes). Apple's documentation on this subject is VERY unclear about which devices support what. It says "call these methods, and rely on what they return". I've already posted on their developer forums that I wish they would just make it CLEAR which devices support which modes.

Apple's "official" documentation for testing for availability

My blog post documenting how this works on 3GS, iPhone 4

phooze
That's funny. While googling for it I actually stumbled upon your blog entry :-) It states "[...] which should be YES for the iPhone 3G/3GS (not iPod Touch)". That's why I even bothered asking if it's probably somehow possible :-)Thanks for your thorough answer!
prattel - yes, it was wrong for 3G. I corrected the blog entry!
phooze