According to Pew research, about two out of three U.S. consumers now own a smartphone, which is an indication of the surge in mobile growth. People are increasingly relying on smartphones for varied reasons, right from buying groceries online to booking their taxi rides.
In this blog, we will figure out the capabilities of geofencing and explore certain best practices to be followed while developing location-based mobile applications that make use of android geofencing.
A geofence is a virtual perimeter of interest that can be created to trigger notifications, when a user enters or exits, or during both enter or exit instances. Mobile app developers can utilize android geofencing capabilities for a variety of reasons, which would not only benefit consumers, but businesses as well. Here are some examples that highlight how geofencing can be effectively utilized.
- When a consumer enters a restaurant, owners can advertise their popular offerings or showcase menus to their consumers directly on their mobile devices.
- Alerts can be triggered to parents when their kids school bus is about to reach home, which would alert them to go and pick them up.
How Does Android Geofencing Work?
Today’s smartphones are built to detect their current location (when the option is enabled). Further, when a user registers a location as part of their interest, they can be notified whenever they enter or exit that location. A geofence serves a similar purpose, in which each area is considered as one geofence point.
To elaborate further, each geofence point contains three major attributes.
- Radius (Draws a virtual geographical boundary with the specified radius.)
Android geofencing virtually draws a circle at a given latitude and longitude point with the given radius.
When a user enters or exits a geofence region, mobile app notifies the user by registering to following events for each geofence point:
- GEOFENCE_TRANSISTION_ENTER – Indicating that the user enters the geofence(s).
- GEOFENCE_TRANSISTION_DWELL – Indicating that the user enters and dwells in geofences for a given period of time.
- GEOFENCE_TRANSITION_EXIT – Indicating that the user exits the geofence.
Setting Up Android Geofence Monitoring
Firstly, a smartphone or mobile device must be aware of its current location only then it can identify if it has entered a registered area, after which it can trigger geofence events.
Current Location Awareness
- Utilizing location services, mobile devices fetch their position (latitude and longitude).
- In order to fetch location, device’s ‘Location Services’ must be switched on.
- If the ‘Location Services’ are turned off despite a user entering a designated region, the device will not trigger geofence call back for entry/exit event.
Fetching details of a location by utilizing the ‘Location Services’ on a mobile device impacts its battery consumption. In order to reduce battery consumption, mobile app developers can utilize the below modes.
- Needs GPS FIX
- High battery usage
- Most accurate up to 0.01 miles
- Battery consumption 7.5% per hour
- Uses mobile data/Wi-Fi
- Moderate battery usage
- Block level accuracy up to 0.06 miles
- Battery consumption 0.6% per hour
- Uses only mobile data/Wi-Fi
- Low power usage
- City level accuracy up to 6 miles
- Uses no power or minimal power usage
- Receives location updates, when requested by other applications.
But in real time, it has a balanced accuracy and low power location from GPRS (Cell tower triangulation) and accuracy up to 2.5-3 miles. As mentioned earlier, a mobile device can identify registered geofence points only after it is aware of its current location.
ACCURACY_MODE SELECTION CRITERIA
In order to ascertain the ACCURACY MODE, which is most ideal to identify a location, we need to understand how a device identifies its current location using GPRS and GPS. Let us find out what transpires when a device fetches its current location using GPRS.
How GPRS Locates a Device?
Let us keep the device at a stationary point (In this case HIG-H-29), request location updates with criteria PRIORITY_BALANCED_POWER_ACCURACY and observe how the device receives its current location (latitude and longitude) with GPRS in a span of 5 minutes. Here are the observations:
Mobile device identified its current location as 0.2 miles away from its actual location.
Mobile device identified its current location as 0.6 miles away from its actual location.
As PRIORITY_BALANCED_POWER_ACCURACY mode utilizes GPRS/Wi-Fi to obtain the current location of a device, it has a block accuracy of 0.06 miles. If we draw a circle from the obtained latitude/longitude with 0.06 miles radius, the device can be located in that circle. With this accuracy mode, mobile app can trigger geofence entrance and exit events, even when the device is 0.06 miles away from its registered location. This is ideal; if we just need notifications for a city, e.g., while traveling on a highway.
On Road Geofencing Test with GPS and GPRS
Test 1 – With PRIORITY_HIGH_ACCURACY
We had conducted a road test with PRIORITY_HIGH_ACCURACY (GPS) mode for 9.4 miles with 9 geofence points. The distance between each geofence point was around 1.2 miles.
Geofence Entry/Exit Notifications Log with GPS
06:30:44 PM: VBIT PARK EXIT GATE, -Entered
06:31:53 PM: VBIT PARK EXIT GATE, -Exited
06:32:44 PM: RAHEJA CIRCLE, -Entered
06:36:05 PM: RAHEJA CIRCLE, -Exited
06:37:56 PM: MADHAPUR POLICE CHECKPOST, -Entered
06:38:42 PM: SHILPARAMAM, -Entered
06:38:54 PM: MADHAPUR POLICE CHECKPOST, SHILPARAMAM, – Exited
06:41:54 PM: BIRLA SOFT, -Entered
06:42:43 PM: BIRLA SOFT, -Exited
06:44:16 PM: GINGER COURT, -Entered
06:45:28 PM: GINGER COURT, -Exited
06:45:56 PM: REEBOK SPORTS, -Entered
06:48:43 PM: REEBOK SPORTS, -Exited
06:48:49 PM: BASKIN ROBBINS, -Entered
06:49:38 PM: BASKIN ROBBINS, -Exited
06:50:11 PM: PEDDAMA TEMPLE, -Entered
06:59:29 PM: PEDDAMA TEMPLE, -Exited
When a road test was carried out with PRIORITY_HIGH_ACCURACY(GPS) mode, each and every geofence was identified, entered and exited one by one and it was highly accurate.
Test 2 – With PRIORITY_BALANCED_POWER_ACCURACY
Additionally, we had conducted another road test with PRIORITY_BALANCED_POWER_ACCURACY (GPRS) mode for the return journey of test1 route.
Geofence Entry/Exit notifications Log GPRS (Return Journey)
07:01:13 PM: BASKIN ROBBINS, PEDDAMA TEMPLE, REEBOK SPORTS, -Entered
07:03:21 PM: BASKIN ROBBINS, PEDDAMA TEMPLE, REEBOK SPORTS, -Entered
07:08:59 PM: GINGER COURT, -Entered
07:13:47 PM: BIRLA SOFT, -Entered
07:13:47 PM: BASKIN ROBBINS, PEDDAMA TEMPLE, -Exited
07:13:58 PM: REEBOK SPORTS, -Exited
07:16:57 PM: MADHAPUR POLICE CHECKPOST, -Entered
07:17:26 PM: RAHEJA CIRCLE, -Entered
07:21:03 PM: VBIT PARK EXIT GATE, -Entered
When an on-road test was carried out using GPRS, the mobile device also identified areas that were almost 2.2 miles away. Further, the mobile device identified BASKIN ROBBINS, PEDDAMA TEMPLE, REEBOK SPORTS, which were marked at the origin of the route, even though they were further down the path and almost 3.7 miles away.
Even though the mobile device was present at location ‘X’. The latitude and longitude of GPRS located the device anywhere in the range of 2.0 to 3.5 miles radius, which means that even though a mobile device passes a given locality, it may identify the location after traveling 2.0 to 3.5 miles.
Utilizing android geofencing certainly impacts a mobile device’s battery life; mobile application developers should carefully select the ‘accuracy’ mode that suits their mobile apps requirements. It does not need any hardware as it comes integrated within the mobile app & asks for user permission to monitor the location in mobile app that utilizes android geofencing. Android geofencing is best suited for large-range targeting, varying from 100-10,000 meters of a radius.
Evoke’s Mobility Services
At Evoke Technologies, we are committed to helping more businesses like yours discover how much they stand to gain from going mobile. We learn the ins and outs of your work to pinpoint where mobility services can make a measurable difference. With a proven experience in developing mobile applications across across native (iOS, Android) and cross-platforms. Our diverse mobile app development services enable enterprises to go mobile while keeping their long-term business goals into consideration.
Contact Evoke now at (937) 660-4923 to learn more about how we can equip your enterprise to go mobile.
Sravanth Addanki is a Senior Technical Associate at Evoke Technologies with over 8 years of experience in the software industry. He specializes in mobile application development predominantly for Android devices. In his spare time, he likes to read and explore emerging technologies.