Radius Networks Developer Blog

Geofence Performance Testing on iOS

Christopher Sexton 28 Aug 2015 Permalink

Beacons have been all the buzz around Radius Networks, but sometimes they are not quite the right tool for the job. Sometimes, the problem at hand is better solved with good old geofences. The problem is geofences don’t always work how you’d initially expect. So we did some testing.

Below is a map around Radius Networks HQ. The circle is a 60 meter radius geofence around our building. The blue pins are where the phone was triggered.

geofence map

This just shows a small sample of the tests we ran. Personally, I preferred the ones conducted around our favorite taco joint.

  • The pins pointing off the lower left of the map were triggered across the river nearly 1000 meters away.
  • All of the pins on M St and off the map were triggered while driving
  • The other pins were triggered while walking

Test configuration

The test was configured using two iPhones (5s and 6) with two apps monitoring location.

  • A Campaign Kit based test app monitoring one Place
  • Apple’s Reminders.app configured to trigger a reminder “When Arriving”
  • Location was disabled for all the other apps on the phones
  • All apps were sent to the background
  • The phones were locked and the screen is dark

We ran about 100 test triggers with this configuration. Out of those both apps triggered nearly every time within 30 seconds.

Both Apps Reminders Only Campaign Kit Only
92 2 1

Not bad. We are still not sure why the minor discrepancies occurred, but they happened infrequently enough that it was very difficult to figure out why. In the end, we were satisfied with the consistency of the behavior we were seeing


You don’t really use GPS for Geofences

The best performance and accuracy can be had by using kCLLocationAccuracyBestForNavigation, however Apple is likely to reject the app unless includes functionality that requires that mode. Most geofence use-cases don’t fall under that.

Keep Wi-Fi enabled

Wi-Fi makes a big difference. Disabling Wi-Fi means the phone falls back to using cell towers to detect major location changes. The problem is a typical phone has enough power to reach a cell tower up to 45 miles (72 kilometers) away. That means there is a pretty good chance for your phone to connect to a distant tower giving a false-positive.

This is reinforced by Apple’s Documentation:

The specific threshold distances are determined by the hardware and the location technologies that are currently available. For example, if Wi-Fi is disabled, region monitoring is significantly less accurate. However, for testing purposes, you can assume that the minimum distance is approximately 200 meters.

The radius of the geofence needs to be big enough

Our testing was done with a 60 meter radius, and, honestly, this was probably too small. Geofencing should be used for fairly large areas, normally about 200 meters. Anything less and you are unlikely to get a trigger.

Our test was based on comparing the Apple Reminders.app with Campaign Kit, so we copied the default settings that Reminders uses for geofences. By default, the Reminders app generates a 60 meter radius. This is at odds with their documentation, but we wanted to be consistent with their app behavior.

Geofence performance is affected by user behavior

This test was explicitly run with the app in the background and the phone locked with a dark screen. But as we’ve discovered through many fumbled tests if you wake up the phone it will respond much faster. We believe that the operating system uses this as an opportunity to scan for Wi-Fi and cell towers. Taking advantage of that information will trigger any apps that happen to be monitoring.

There are some unexpected conclusions discovered in this testing. But it appears that most of the caveats are there to help the all-important battery life of the phone.