How geofencing works in short
Behind the scenes, geofencing works by repeatedly checking whether a phone’s estimated location sits inside a saved shape. A geofence is that saved shape: a virtual perimeter set around a real-world area. When the answer changes from no to yes, or yes to no, the system treats it as an event.
Three things drive every result. The first is how well the phone knows where it is. The second is the size and shape of the boundary, and the third is which event the system listens for.
Each geofence can be watched on its own for entrance, exit or dwell. Dwell means the phone has stayed inside for a set length of time. The rest of this guide walks through the stages in order.
Steps a business follows when a geofence is set up
A business owner usually meets geofencing through an app developer or an ad vendor. The steps are similar either way. Knowing them makes it easier to ask good questions before any campaign or feature goes live.
-
Pick the place. Choose the point of interest, such as a store, a showroom or a competitor’s lot. Ad systems accept a ZIP code, a street address, a pair of coordinates or an IP address as the anchor.
-
Choose a shape. Android only supports circles, each defined by a center point in latitude and longitude plus a radius measured in meters. Research systems such as NASA’s model fences as polygons, with keep-in and keep-out regions.
-
Set the radius. Google recommends at least 100 to 150 meters on Android. Anything smaller sits inside the normal error of a phone’s position.
-
Choose the trigger. Decide whether the action fires on entry, on exit or after a dwell. Android sets the dwell wait with a value it calls a loitering delay.
-
Decide on the monitoring mode. A foreground fence relies on GPS while the app is open, which is heavier on the battery. A background fence skips GPS, so it cannot send alerts in real time.
-
Get location permission. The phone’s owner must allow the app to use location. Without that permission, the fence never sees the device.
-
Let the phone report its position. The device draws on location signals from satellites, nearby Wi-Fi networks and cell towers. Modern phones usually blend these sources.
-
Act on the event. When the system logs a crossing, it runs the planned action. That might be a reminder, an ad impression or a record that a device visited.
-
Review what fired. Compare the events against what really happened at the location. A fence that fires for passing traffic, or misses known visitors, needs a new size or trigger.
In advertising, a further step often follows. A vendor may check whether phones shown an ad turned up at the business afterward. The industry calls this walk-in attribution.
Factors that shift the result
Four factors decide whether a geofence fires at the right moment for the right phone. They are signal quality, fence size, timing and the number of fences in use. Each one has a known limit worth planning around.
Signal quality
Under open sky, a GPS-enabled smartphone is typically accurate to within 4.9 m (16 ft). Buildings, bridges and trees make that worse. Indoors, Wi-Fi positioning is typically good to 20–50 m.
Wi-Fi positioning has a quirk. It compares nearby access points with a database of where they are believed to be. If someone moves an access point, the phone can be placed in the wrong spot.
Cell ID is the weakest source. Cell ID uses a single tower, and it is least accurate in rural areas where towers are far apart. Away from Wi-Fi, such as on a rural drive, Android accuracy can fall to several hundred meters or more.
Fence size and shape
A fence that is too small misses phones that are really inside. A fence that is too large captures neighbors, passersby and nearby businesses. The size choice is a trade between missing real visitors and counting false ones.
A circle is simple but rarely matches a property line. A polygon can follow a parking lot or a building footprint more closely. Not every system supports polygons, so ask what a vendor offers.
Timing
Android geofence alerts usually arrive within about 2 minutes. Under the background limits in Android 8.0 and later, the average is 2 to 3 minutes. A device that has been still for a long time may wait about 6 minutes.
Fence count
Each Android app can keep no more than 100 fences live for any one person’s device. A chain with many branches cannot keep every fence live on every phone. Apps rotate which fences are active, often based on where the user is.
Ad platforms work differently from single apps. A guide to geofencing marketing compares how ad vendors use fences with other ways of reaching nearby customers.
What happens to the data afterward
Every event leaves a record of a device being at a place at a time. Those records can reveal far more than one visit. The FTC alleged that InMarket matched arrival, stay and departure data to points of interest.
That is why the data trail deserves as much thought as the fence. A business should know who stores the events, for how long, and for what purpose. Vendors differ, and their terms are worth reading closely.
Mistakes that weaken a geofence
The most common mistakes come from treating a geofence as more precise or faster than it is. Others come from ignoring the law or the user’s consent. Each of these is easy to avoid once the limits are known.
Drawing the fence too tight. A radius below about 100 to 150 meters fights the phone’s own error. The result is missed entries and random exits.
Using the enter trigger for everything. A phone driving past a store counts as an entry. Google recommends the dwell trigger to cut down alert spam.
Expecting an instant message. A greeting timed for the front door may arrive after the customer has reached the checkout. Plan offers that still make sense a few minutes later.
Trusting visit counts as exact. No official source shows how accurate walk-in attribution is. Treat vendor visit figures as estimates, not head counts.
Fencing a health care site. Washington law forbids fences around in-person care providers when they are used for tracking, health data or related ads. New York law forbids fencing someone else’s health care facility for ads, profiling or guessing at a person’s health.
New York’s rule covers any fence with a radius of 1,850 feet or less. That is far larger than most store fences, so a clinic several doors away can fall inside it. This guide is not legal advice, and local rules should be checked first.
Assuming location consent covers ads. A user who allows location for an app feature may not expect ads to follow. Clear consent for advertising use is the safer basis.
Ignoring rural conditions. A fence that works in a dense town can fail on a highway edge. With few Wi-Fi networks and distant towers, phones may be placed hundreds of meters away.
Forgetting moved equipment. A relocated Wi-Fi router can still be listed at its old address in location databases. Phones near it may then report the wrong position, so odd results near one spot deserve a second look.
Frequently asked questions
How do you do geofencing?
You choose a place, draw a circle or polygon around it, and pick a trigger such as entry, exit or dwell. An app or ad system then compares each phone’s estimated position with that boundary. When a crossing happens, it runs the action you set.
What are the downsides of geofencing?
Location estimates can be off by tens of meters indoors and much more in rural areas. Alerts usually take about two minutes to arrive. Some uses are restricted by law, such as fences around health care facilities in Washington and New York.
How small can a geofence be?
Android guidance from Google puts the smallest sensible radius at 100 to 150 meters. That floor exists because Wi-Fi location is typically accurate only to 20–50 m.
Why does a geofence alert arrive late?
Phones save power by checking location less often, especially in the background. Under Android 8.0 and later limits, alerts average 2 to 3 minutes. A device that has not moved for a long time may take about 6 minutes.
Does geofencing drain a phone’s battery?
It can, depending on the mode. Foreground monitoring uses GPS and costs more battery. Background monitoring skips GPS but cannot support real-time notifications.
Where this guide sits in the geofence hub
This guide covers the mechanics. The geofence hub also explains what a geofence is, how businesses use one in advertising, and where the law draws lines. For the full set of topics in one place, see geofences explained.
