Location-Based applications are one of coolest things and are the driving force of new innovations. We have already discussed a lot about the location apps for Android, and as discussed in the last blog, today we will be talking about Geo-fencing:
(A) What Is Geo-fencing:
‘Geo-fence’ refers to the virtual perimeter created around a business which allows it to track people/object. With GPS-enabled smartphones, the user’s location can be known when an individual is found within the business’s previously formulated boundaries. Any program which incorporates Geo-fencing feature is more likely to feature to respond to user’s entry and exit across the specified boundary. Hence, Geo-fencing aims at targeting a specific region.
Research Says,
(B) Why Geo-fencing:
Problem: No Network coverage, still want to know user’s location.
Solution: Suppose there is no network and still you want to know user’s location. You would also want to get the user’s location at a very micro level so you can:
1- Consider the last saved location of user in your application. Based on cached location data, you can know the user’s location.
2- You can also provide matching offers based on the last location provided by Network Provider, but that would be the COARSE location of user.
Probably, you would want to know user’s precise location for various purposes. These purposes may vary like:
B- 1 Domain-specific Geo-fencing functionality usages:
- Retail: If consumer will walk within the geo-fenced distance of a shop he/she can be notified with the special offers and incentives to swing by and visit.
- Deliveries: If customers are waiting for a delivery package, they could be notified via text message when the delivery vehicle enters a certain radius of their home.
- Security: Mobiles, tablets, phablets or devices which belong to an organization that deals with sensitive information can be programmed to be disabled when leaving the location.
- Restaurants: Information on special deals, discounts and offers can be delivered to a customer in range of your outlet/restaurant.
- Movie Theatres: Film showing timings could be delivered directly to the nearby regular customers.
B-2 Geo-fencing in Android Applications:
With slow pace, in the last few years Geo-fencing has made its place in various applications and has improved everything right from to-do lists to household management. With wide range of android applications available, these mobile application developers are using the Geo-fencing functionality to make the location-based android apps more scalable and precise.
- Location-based Reminder Apps: Geo-fencers can be used for Android applications which are meant for improving productivity and of course saving time. Applications which triggers reminder messages like Todoist support location based reminders. Hence, great Geo-fencing android apps are available today.
- Smart-home Control Apps: Smart home control applications is an area where geo-fencing has done wonders. There are many android applications based on geo-fencing functionality which helps in turning on the lights of your home while you are approaching towards your home. For example the Samsung Smart Home.
- Food and Grocery ordering Applications: There are many Geo-fencing apps available like FoodPanda and Grofers apps which use geo-fencing functionality extensively. Based on the user’s exact location, the application offers great choices for restaurants (FoodPanda) in that region. Even the Grofers application takes keen consideration about the exact location of the user and based on that the user can order grocery etc.
- Retail Shopping Applications: Deals can be hyper-local. Geo-fencing apps which are of course location based application and have the functionality to send a trigger when customers are nearby. Knowing that customers are nearby lets businesses tailor offers based on local events, festivals and holidays.
- IFTTT (If This Then That): IFTTT (If I’m leaving my office turn the air conditioner on at home” or “if I’m in the house after 8AM on a weekday, text my boss that I’m stuck in traffic” ) recipe system is again a good example to admire the wonders of geo-fencing functionality.
(C) Implementation of Geo-fencing In Location based Android Apps:
C -1 – Create and Add Geo-fences
You may want to create and add Geo-fences using the location API’s builder class for creating Geo-fence objects, and the convenience class for adding them.
C – 1.1 Creating geofence objects
First, use Geofence.Builder to create a Geo-fence hence setting the desired radius, duration, and transition types for the Geo-fence. For example, to populate a list object named ‘mGeofenceList’:
This example pulls data from a constants file. In actual practice, apps might dynamically create Geo-fences based on the user’s location.
C- 1.2 Define an Intent for geofence transitions
The Intent sent from Location Services can trigger various actions in your app, but you should not have it started an activity or fragment, because components should only become visible in response to a user action. In many cases, an IntentService is a good way to handle the intent. An IntentService can post a notification, do long-running background work, send intents to other services, or send a broadcast intent. The following snippet shows how to define a PendingIntent that starts an IntentService:
C 1.3 Add Geo-fences
To add Geo-fences, use the GeoencingApi.addGeofences() method. Provide the Google API client, the Geo-fencingRequest object, and the PendingIntent. The following snippet, which processes the results inonResult(), assumes that the main activity implements ResultCallback:
D – Best Practices Of Geo-fencing (Location based Android Apps):
The above statement validates that whether you own a small business or an owner of huge corporation, Geo-fencing technology helps in grabbing customers’ attention. For a win-win situation you need to have full-proof Geo-fencing campaign and hence your customers would love to receive a special offer, while you receive data of where your users have been and what they are interested in. Foursquare is one such amazing location-based Android app which is an good city guide in your pocket.
– Directions Magazine
Here are some best practices which android application developers of location based android apps must keep in mind:
- User Experience: Your application to be developed is certainly user driven app, hence while designing you need to think about notifications and consider user’s tolerance levels on frequent notifications. You can avoid notification fatigue by throttling the number of Geo-fences and triggered actions.
- Device Performance: Geo-fences also takes a toll on device performance. You must know that location services draws a lot of battery power. This happens because of frequent checks against GPS, Wi-Fi, and maps which communicates with background services, hence using CPU resources for listening notifications. Good designs of application system must be followed which can maintain an equilibrium while local data processes on remote server.
- Location: By now you must have understood that Geo-fencing technology is everything to do with user’s location. Application must tailor to the needs of the user who are going to use it. For example, FoodPanda would want to create a Geo-fence around areas where it’s relevant users are available. The Geo-fences could be tighter and spread throughout the region.
Don’t forget to check : Location Aware iOS Apps : A Closer View
The Bottom-line:
Devices are becoming increasingly sophisticated and more elements of our home, vehicles, and workplace enter the ever growing stable of “Internet of things”. Objects are expected to see Geo-fencing applied to more and more devices and environments. The increased integration have started yielding all sorts of novelties like coffee pots turning on in the morning when the first coffee drinkers arrive.
Happy Geo-fencing with Cuppa 🙂