views:

43

answers:

1

I've discovered by tests that setting a low desired accuracy for CLLocationManager leads to a buggy behavior of this component.

Here are the 2 tests I've made :

  1. Set the desired accuracy to kCLLocationAccuracyHundredMeters. Then the device can't find my position as accurately as I want. Here are the logs from my CLLocationManager's delegate :
    Accuracy is 1500.000000 (desired accuracy is 100.000000)
    Accuracy is 1500.000000 (desired accuracy is 100.000000)


    That's it. Two events in 30 seconds with an horizontal accuracy of 1500.

  2. Set the desire accuracy to kCLLocationAccuracyBest. Then the device finds me! Same logs:
    Accuracy is 1500.000000 (desired accuracy is -1.000000)
    ...
    Accuracy is 162.957953 (desired accuracy is -1.000000)
    ...
    Accuracy is 76.356886 (desired accuracy is -1.000000)
    ...
    Accuracy is 47.421634 (desired accuracy is -1.000000)

I'm at the very same spot I was for test 1 but this time, the device is able to find my location with the accuracy I wanted first (ie 100.0).

I've repeated these two tests many many times, for the same results.

My question is : "Does anybody know why the iPhone device doesn't try harder to find my position when I set an accuracy of kCLLocationAccuracyHundredMeters?"

I assume that setting the accuracy to kCLLocationAccuracyBest may turn on some different hardware sensor but can't this be considered as a bug? I couldn't find stuff on the internet relative to this problem.

Thanks for sharing your own experience. (the tests were made with a 3GS device over Wi-Fi and phone network)

A: 

The more granular settings will attempt to locate you via Cell and Wi-Fi triangulation only, which isn't exact. kCLLocationAccuracyBest is going to turn on the GPS module and use it, which should get within a few feet. It's not a bug, you got the accuracy you asked for in both cases.

The difference is because the GPS burns the battery a lot more than triangulation, which is why it's not used if you just need to place the device within a rough area.

Joe Sunday
Hi, thanks for the answer. It may not be a bug because you get a value at the end but the sample code "LocateMe" is bugged then, cause you can see there something like : "if (location.accuracy < desiredAccuracy) { return; }" Basically, this means that Apple's sample code expects the device to find a location with a better accuracy than the desired one. Either the SDK or LocateMe is bugged to me.
Dirty Henry
You're requesting a specific accuracy. You may or may not get it depending on the hardware and your current location, so it's up to you to decide what to do in that case. For example, you might be better accuracy with the cell triangulation in a dense city than you will in the middle of nowhere. LocateMe throws it away, you could use it (with a larger location circle for example), or decide after a bit you want to try for an even more precise reading, with the trade-offs that entails.
Joe Sunday