(or how turning off Wi-Fi broke my app)
I’m currently in the process of writing an app for iOS that uses the new(ish) region monitoring API introduced in iOS 4.
Initially I wrote a small ‘spike’ app to test the API and ensure that it would do what I wanted and to check how reliable it was I was pleasantly surprised. After I was convinced that it could do what I needed, I started to test its accuracy and how battery life was affected. Here are a few things I found:
Don’t rely on using the simulator when it comes to location and map kit testing there are a few bugs that only appear in the simulator such as, maps not tracking correctly, random location failures and the location icon appearing in the status bar even though the GPS is not running. Going for a walk or getting on a bus is the best way to test.
When monitoring regions the GPS is not switched on it only relies on cell tower and Wi-Fi information to get your location. This is despite the location arrow being displayed in the status bar. I tested this by running the energy diagnostic instrument in Xcode to see when the GPS was enabled in my app and it never was.
This was further confirmed when I was testing my app and suddenly I stopped getting region updates altogether. What had happened was that I had turned off Wi-Fi on my phone which meant that region monitoring fell back to mobile cell towers and because I had never moved outside of a cell area no update ever occurred.
Further testing of location accuracy (using startMonitoringSignificantLocationChanges in CLLocationManager) I found that the accuracy of your location via a cell tower could be up to 1.2 km out which is quite poor.
So my conclusion is that monitoring regions in iOS is not a drain on the device’s battery as the GPS is not used however with Wi-Fi disabled the accuracy of detecting the entering and exiting of regions will be quite poor as it only relies on cell tower data.