Geofencing in Mobile App Development

Geofencing in Mobile App Development

Geofencing is a feature in a software program that uses the global positioning system (GPS) or radio frequency identification (RFID) to define geographical boundaries. A geofence is a virtual barrier.

Geofencing concept is not as new as most people think. Its benefits are known for several decades, but in the early days, geofencing systems required complex and expensive hardware and software solutions. Today we can build virtual fences and target people inside them, with minimal hardware equipment and coding expertise.

New geofencing apps, use various sources (like GPS or location platform’s IP address) to calculate users’ location and present them with a unique set of commercial offers or some other contextual information. They are great for targeting leads and turning them into customers. In addition to this their installation is quite simple.

Wide availability of this feature in new generation mobile apps is causing many location-based businesses to add geofencing to their marketing mix. This initiated an ongoing geofencing revolution in mobile apps’ development and in this article we will analyze the ways developers can use for adding this feature to their app’s UX.

Geofencing requirements

First geofencing systems were applied on cattle ranches, and they required farmers to place GPS units on every cattle head. Today we can pack the whole geofencing system into a few code snippets that makes use of smartphones’ pre installed location hardware. These geofencing features are also available with many advanced app makers. App developers who want to add geofencing to their apps need to:

1. Make sure that their app has proper permissions

Each app that is using geofencing technology needs to have location permission. Most developers choose to get users’ location outside app’s UI thread. This starts a permission request prompt when user launches the app for the first time. Users can also modify permissions in the app settings later on. Developers receive notification about each permission change, which allows them to closely follow their audience.

2. Define geofence

Each geofence is defined by the specific set of parameters. These include:

  • Latitude, longitude and radius of the geocircle (geofence technology can only be applied on circular-shaped areas)
  • Geofence’s ID
  • Types of events that app developer wants to be notified about. For example app developer can be notified when new user enters geofence region, when geofence app is removed from user’s smart phone etc.
  • Time value that specifies how much time app users need to spend in geofence area before they receive the first push notification (a.k.a. Dwell Time).
  • Sources for acquiring users’ location data. For example very small fences can work, only if user’s device has GPS, while other location sources have their own specific characteristics.
  • Start Time, which indicates when geofence monitoring should start
  • Duration, which indicates how long geofence monitoring should last.

3. Manage geofence notifications

There are two ways how app on user’s phone can receive notifications from predefined geofence. Users may see notifications only when the app is running in the foreground, or notifications can be sent when an event occurs, by setting up a background task. Background notifications are much more useful for location based businesses, but installation of these apps requires users to take some prompt action. It also requires developers to add background tasks to their app’s manifest, define background task types, set each task type to one location source and define the entry point inside the app that will be called when the event gets triggered. Developers also need to write additional code snippets that will define all other important criterions that are necessary for running background tasks.


Geofence is a great way to make mobile apps location aware. In spite of the popular belief, this concept saves user’s smartphone battery, because geofence manages to handle information info for all phone apps at once, and activate each notification at the right time. The most important thing for app developers is that geofencing allows them to make their apps more smart and contextual, which leads to their wider acceptance among users.

Posted by Nate Vickery

Nate Vickery

Nate Vickery is a business consultant focused mostly on SMB marketing and management. Nate is the editor-in-chief at one business blog - You can follow Nate @NateMVickery

Related Posts


comments powered by Disqus