A Guide to Geofencing in Mobile Applications

What is Geofencing?

Geofencing is a tool used to monitor a location and the region that surrounds it – through events like entering, exiting, or staying within the region. They are registered on a device and will be monitored whether an application is open or closed. Creating geofences requires three main specifications: latitude, longitude, and radius,  and sometimes a label so that it can be uniquely identified. The latitude and longitude are used to pinpoint the location of interest, and the radius is used to define how wide the geofence – or monitored area – will be.

For example: let’s say the location of interest is your house and your house is surrounded by a fence. The fence represents the geofence that you want to monitor and so the distance from your house to the fence is a good way to think about the radius of the geofence.

Types of Geofences

There are two types of geofence shapes: circular and polygonal.

Circular Geofences are standard with iOS and Android. Polygonal Geofences aren’t native to iOS or Android, but can be handled by consistently monitoring a device’s location, and checking if that location lies within a polygonal area using a point-in-region algorithm.

How does Geofencing Work?

Geofencing works by monitoring a device’s location using cellular triangulation, Wi-Fi triangulation, and/or GPS monitoring.

Cellular Triangulation

The approximate distance from a device to a cell tower can be determined by the time the device takes to respond to a ping from the tower. So if we have multiple towers near the device, we can take the response times from each tower and roughly determine the location of the device.

Wi-Fi Triangulation

Similarly to cellular triangulation, Wi-Fi triangulation uses Wi-Fi hotspots and wireless access points to determine a device’s location. So if we have multiple hotspots near the device, we can take the response times from each hotspot and roughly determine the location of the device.

GPS Monitoring

Global Position System (GPS) is a satellite-based radio navigation system that provides geolocation to a GPS receiver (mobile device). GPS does not require any internet or data connection but used in addition to one of these services it can help determine a more accurate position for a device.

Setting Up a Geofence

Geofences feature some common configurations. Most geofences have the following:

  • Latitude
  • Longitude
  • Radius
  • ID (or some sort of identifier, i.e Home)
  • List of event triggers (i.e enter, exit and/or dwell)

The minimum reliable radius of a geofence is 200 meters. This is because location accuracy varies depending on the availability of a reliable connection. When Wi-Fi Triangulation is readily available, location accuracy is usually between 20 – 50 meters. When Wi-Fi Triangulation isn’t available (for example, when you are driving in a rural area) the location accuracy degrades. The accuracy range can be as large as several hundred meters to even several kilometers. Because of this, you should create geofences using the largest possible radius.

Monitoring a Geofence

Geofence Events

There are three ways you can monitor a geofence: entering, exiting and dwelling. Events can be triggered when a device enters or exits a region, or when a device stays (dwells) within a region for a specified amount of time.


For example: consider the geofence example of a house and fence, when someone enters or exits the fence to your house, the geofence’s enter or exit events would be triggered. If someone were to enter the fence and then stay inside the fence, the geofence’s dwell event would be triggered.

Things to Consider

Multiple Geofences

Multiple geofences can be monitored at a time on a single device. However, there are restrictions in place for both iOS and Android devices:

  • Android – can monitor up to 100 geofences per application
  • iOS – can monitor up to 20 geofences per application

Battery Drain

Location monitoring directly affects how quickly a device’s battery drains based on accuracy, frequency and latency.

  • Accuracy: how precise the location data is.
  • Frequency: how often a location is retrieved.
  • Latency: how quickly a location is delivered or received by an application on the device.

It’s important to keep in mind that constantly monitoring a device’s location or tracking geofences will affect the battery life of the device.

Accuracy and Reliability

It is expected that the data connection (via cellular or Wi-Fi) will fluctuate while a device is in motion. So we shouldn’t rely or expect high resolution data to be passed to a device throughout the monitoring of a geofence. This is why it’s important to select a generous radius for a geofence. Which provides more reliability in a geofence event being triggered.

Example Use Cases for Geofences in Mobile Applications

Geofencing is useful when you want to set up location-based tasks:

  • Send a reminder to walk the dog when you get home
  • Send promotional offers to shoppers as they pass by stores
  • Access location-based filters for a social media application

Want to learn how geofencing can improve your mobile applications? Give us a call.