Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use only region monitoring + GSM and to get not more than 5 km horizontalAccuracy?

I would like to share the info of my performed testing scenarios and to ask you to share your experience with region monitoring. So, I have registered two opposite regions (A and B) with 5 km radius and 1 km desiredAccuracy, with the 20 km distance between them. However, I haven't received any didEnterRegion/didExitRegion events when traveling from A to B. In my app prototype, I also put two buttons (for testing purposes): one starts significant change and another standard location monitoring. Both prints didUpdateToLocation events on-screen-log.

So, after getting to the center of region B and being very annoyed about the unpredictable functionality, I have enabled significant monitoring. After that, I have received several didUpdateToLocation with horizontalAccuracy of ~8.5 km! Wow, that hurts, because all I want to do is to have a functionality where a user would be notified, that his desired place is somewhere in radius of 5 km from his current location position, and I want to rely on GSM cell triangular location detection method only (for preserving the battery).

So, back to my case. After getting such a big 8 km error, I have enabled standard monitoring with best accuracy (GPS). And bingo, I have received didUpdateToLocation event with horizontal accuracy of 399 m, and only then, I have received didExitRegion from my initial place (region A), and another event with didEnterRegion (B). Another updates from didUpdateToLocation where a little bit more accurate - 50m.

In previous scenarios, I was getting unstable accuracy also. Sometimes there were 4 km horizontalAccuracy, sometimes less. But the main question that is, if we want to preserve the battery (Apple teaches us that in docs) then can we rely only on region monitoring + GSM without using GPS? There's a sample of Apple code with "proper use of region monitoring" (here), however there are some unacceptable things there:

1) They state that sample code works only for iPhone4, though Apple docs state that both region monitoring and significant monitoring are supported on iOS4.0+. Cool, ha?

2) The sample code uses all 3 location methods: significant, standard, region. It uses region monitoring all the time but in addition in uses standard location with best accuracy. When app enters background it stops standard and starts significant change monitoring. When entering foreground then app stops significant and starts standard location. Seems like apple docs are quite vague, it's unclear what penalties (horizontalAccuracy) do we get if we use only region monitoring, or do we have always to use all three methods?

3) Apple docs state that we need to preserve the battery and to use as minimum location services as we need, if we don't need GPS then we should use GSM (for example, 1 - 3 km desired accuracy). But the sample code uses best desired accuracy (GPS) both for region monitoring and standard monitoring (when app is in foreground). I do understand that GPS would solve all my problems with errors and accuracy, but what about using GSM only? After getting 8.5 km horizontalAccuracy in my scenario, I'm not sure is it possible to use region monitoring at all because it's unable to provide at least 5 km acceptable error.

like image 766
Centurion Avatar asked Nov 13 '22 14:11

Centurion


1 Answers

In my experience, the region monitoring is pretty accurate without a significant loss to battery life. I have a use scenario of regions that are only 30-50 meters wide. No issues at all with accuracy. One thing I will say, I have only targeted iPhone 4 devices and up. I will need to implement some of the changes you talk about if I want to support the 3GS models.

When relying purely on -startMonitoringForRegion, your updates automatically trigger on the -didEnter and -didExit events. These are triggered through a combination of location tracking events. Significant changes, cell tower transfers, connection to WiFi, another app requests location, and a few others. The OS handles when the callbacks are triggered from these other shared location events. In my experience, it has been very accurate. But this is only for iPhone 4 and up.

I also used the example app from Apple to get things set up, but there isn't a lot of detail in the documentation about the specifics of the when/where you will get your trigger. You can read up on what Apple provides in the Location Awareness Guide. Hope this helps.

like image 130
Bill Burgess Avatar answered May 16 '23 08:05

Bill Burgess