Follow

Geofence Explained

What is Geofence?

A geo-fence is a virtual boundary around location specified by the location GPS coordinate acting as its center and a radius value which is the distance to the boundary from the center in all the directions

How does it work?

It works based on the location of the device. When a user crosses the boundary of the geo-fence while entering/exiting it, an event is generated notifying the system about the entry/exit respectively.

  

How is it implemented?

Geo-fence implementation is in the SDK is directly based on the OS-provided APIs/capabilities.

For iOS, we use the Monitoring callbacks provided by the CLLocationManager.

For Android, we use a third-party library called AltBeacons which in turn uses the OS provided services for monitoring.

Events

The geo-fence events (entry and exit) are boundary-crossing events and are directly driven by the device's current location. Please refer to the diagram above. This means the event is only generated when user crosses the geo-fence boundary e.g., No entry event will be triggered if the app is launched within the geo-fence.

Dependencies

Potential scenarios that could impact on the accuracy of the events;

  • Location access for the app. Region Monitoring requires a full location access to the app for it to work. This is because monitoring continues even if the application is not in foreground. If the location access is not provided accordingly, application will not be able to monitor geo-fences properly.
  • If the application is in foreground or background. Sometimes it is seen that event notification by the OS is a bit lazy when the application is in the background rather than foreground. Although this is not very prominent
  • In Android, there is an extra setting to set the accuracy level of the Location services e.g., High Accuracy, Battery Saving, Device Only. This setting can further have an impact on the accuracy of the geo-fence updates.
  • Location services turn on but Push message notification setting turned off for the application.
  • Push notification set up in the app or the certificate/key uploaded on the server end might not be proper which will prevent the push notifications from coming through.
  • Connectivity state of the device
    • If a device has a sim card in it or not.
    • Is the device connected to a public Wi-Fi network?
    • Is the device tethered to a hotspot?
  • Environmental factors: Surroundings where the device which sometimes makes the location locking difficult resulting in a less accurate location e.g., in a subway or in a basement etc.
  • Set up of the geo-fences e.g., the radius, UUID's etc. Although the chances are slim but If two geo-fences with the same UUID’s intersect, there will be no entry event for the second geo-fence.
  • Differences between OS monitoring of geo-fences
    • iOS has a restriction on the maximum amount regions monitored for an application. This includes the beacons/geo-fence region monitoring. Therefore, the SDK can only monitor a maximum of 15 geo-fences at any given time with 5 slots kept free for beacons.

Any of these scenarios or a combination could impact on the ability to receive push messages.

How is this mitigated?

SDK overcomes the 20 regions restriction by registering to the significant location updates of the user and updates the currently monitored geo-fences to be the nearest to the user as the user moves.

OS employs some techniques e.g., delaying the exits based on some buffer time and duration outside the region to make the experience more reliable.

Other things to mention is the radius. Both iOS and Android suggest the radius of the geo-fence to be at least 200-300 meters for more reliable entries and exits event reporting.

The result:

Taking into consideration the various dependencies on getting device location which causes a degree of uncertainly with the location lock these events can sometimes be delayed or skipped altogether.

Baseline testing has been conducted resulting in an average hit rate of these events ranging from 75%-80%

The SDK testing including 4.28.3 and later versions of the SDK was done with both real world means and the simulated means by using the FakeGPS on the Android, XCode location simulation on iOS. In case of the simulated testing, the results were very accurate with above 95% of the events correctly reported. However, in the real world the impact of a lot of above mentioned factors is magnified and the accuracy was about 75%-80%.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.