Creating Smarter Apps with Geofencing
What is Geofencing?
Geofencing is a term used to describe a virtual perimeter around an object (this object can be stationary like a store) or a subject (like a human being that can move around). The use of geofencing became increasingly popular in the mobile space when Apple introduced it to the Reminders App in many different geofences registered with the Operating System (OS) but the maximum number of geofences an App can register is usually limited. iOS limits this amount up to 100 but on Android it does not appear to be such limitation. When using a geofence, the user typically sees an icon in the status bar, for example, a hollow purple location arrow on iOS.
The use of geofencing became increasingly popular in the mobile space when Apple introduced it to the Reminders App in many different geofences registered with the Operating System (OS) but the maximum number of geofences an App can register is usually limited. iOS limits this amount up to 100 but on Android it does not appear to be such limitation. When using a geofence, the user typically sees an icon in the status bar, for example, a hollow purple location arrow on iOS.
I started working with geofencing for mobile devices before iOS 5 became an accepted minimum OS version to support, and before they were introduced on Android. A quick rundown of how we accomplished geofencing on iOS before actually having geofencing APIs was through the use of “Significant Changes In Location.” This is a service provided by the OS that notifies the app when the user moved a “significant” change in location. Based on this location, the app would then determine if the user was in a given region. This concept can still be used but it has been phased out with the introduction of new interrupt mechanisms, sometimes at the hardware level, that make it possible for iOS devices to be notified instead of polling the location hardware every so often (typically 5 to 10 minutes). Therefore, this results in more accurate algorithms, apps that perform better, and significant battery life savings.
In order for mobile devices to alert the app that the user has entered or exited a geofence, at the low level, you can say the mobile device is tracking the user’s location to some extent, although the app does not need to know the details of where the user is exactly located. Depending on the accuracy of the geofence specified by the app, this tracking can be more or less accurate, resulting in different battery implications.
If we setup a set of geofences around a static location or center, each geofence being bigger in radius than the previous one, then the last geofence will create a region that encompasses all other concentric regions created by the smaller geofences. This important to keep in mind specially if a user is moving away from the center, then the app receives “exit” geofence notifications, and if the user is moving towards the center, the app receives “enter” geofence notifications by the system.
With iOS 7, there is a new interesting spin on geofencing. Using Bluetooth Low Energy (BLE) technology, the concept of geofencing has been further enhanced so that a geofence can work without tracking the user’s location. This approach is much more scalable and it uses low-power Bluetooth signals to determine if a user has entered or exited a geofence. The way this works is as follows: the user can download an app for a particular store (this app specifies a unique key or “beacon” identifier). A beacon is a device that acts as a BLE peripheral by advertising a service. A beacon could be a small hardware device designed for this purpose or a generic device like an iPad or iPhone acting in peripheral mode. The advance to this is that for example, a retail store with many locations, can set up a beacon in every store, and as long as the user has an app that registers a geofence with this key, the user will be notified of entering and exiting a geofence around these beacons. This also means more stores can be added to work with this app, by simply purchasing more beacons, without the user having to update the app or setting up geofences for new stores in the app.
A quick background on BLE (and if you want to read more about it check out our other post. This is a fairly new technology, already supported on the latest iOS devices, and soon to be released in the next version of Android (4.3). It can provide a range of 50 m, a data throughput of 1 Mbit/s, it requires very low power (< 15 mA), and it provides an easier way to pair devices than Classic Bluetooth. Apps that use BLE are starting to show in all areas such as healthcare, fitness, home automation, entertainment, etc.
The combination of using BLE and beacons and geofencing using location services is very powerful and has many potential applications. We are starting to see a new wave of apps that combine the power and mobility of a user’s phone with that of small sensors and devices that communicate using BLE. For example, just a few ideas that come to mind that could use this technology:
An example is the ability to send coupons to customers and promotional adds as they enter a store and the ability for the store to also obtain customer information, let’s say for getting the user registered in the store’s mailing list. Also, knowing when the user is near a cash register or has left the store can provide even more functionality, like emailing a receipt after a purchase.
Using beacons, these large stores can provide the user with a map of where certain kind of items are located in the store. Beacons can be set up for each of the store’s departments or sections and based on the received signal strength of the beacon and in combination with indoor map capabilities (already supported by Google Maps), it could provide great context-aware applications for stores.
A museum could set up a beacon for each painting or piece of art. The user would download the museum app when going to the museum or exhibition and as the user walks around the museum, they could choose in the app to listen to an explanation, in any language, of the artwork in from of them. This app can even be generic to work for all museums. This would eliminate the need for those sometimes complicated audio devices and reduce paper printed guides.
iOS will in, turn use, this technology to advertise to the user of apps available that would be useful to the user at a particular moment in time depending on where the user is located. For example, if the user goes to a park, and the park has a beacon, the AppStore app, listening for “any” beacon, can notify the user that an app for this park is available such that if downloaded, more information about the park can be obtained (for example, like a map of hiking trails inside the park).
Light switches or lightbulbs can detect when a user is nearby without requiring motion sensors. This is in some cases preferable than motion sensors. Another use in the home can be for manipulating thermostat settings automatically for the user once the user get home (as opposed to prior to the user getting home which would require the other type of geofence tracking and could be more battery intensive). Another usage can be for opening the garage door of your home when you arrive (eliminating the need to find the remote and hit the button).
Beacons can be used to open doors and gates that require authentication or passwords. Granted that for security reasons, this may be less secure, but for applications like securing strangers don’t enter a bathroom at a public office this could work. This type of applications also imply that only certain users would be able to have the unique key that corresponds to this beacon, and this must be secured somehow.
This may seem far fetched, but it would be useful to know if you are at a traffic light looking at your phone if the traffic light changed. However, this is a challenging problem to solve, but we could make headways by equipping traffic lights with inexpensive beacons. The traffic light beacon could broadcast a signal when changing colors. As the user approaches the intersection, the geofence is triggered. The catch is that an interaction can have multiple traffic lights and the ability to provide the user with information about the traffic light that applies to the direction the user is traveling could be tricky.
As you can see, if you think about your daily small struggles (that, for the most part, we seem to be used to), it seems that the possibilities for creating context-aware apps that provide useful solutions, especially when combining technologies such as geofencing, Maps, and Bluetooth Low Energy (BLE), are endless. If you can think of something you want to happen when you or someone is near something, it can be done with the use of geofencing and BLE. I expect to see affordable BLE sensors and beacons that communicate with mobile devices to be embedded in almost everything and users having mobile phones with apps that act as the gateway for interfacing with the real analog world.
Recent Blog Posts
New release of iOS 13 and Xcode 11 by Jose Luis Vega Romero With the new release of iOS 13 and Xcode 11 we could expect nice features, new devices, cool things to try but at the same time some of the updates could be disrupting for your app if not taking the...
Kotlin by Carlos Rodriguez Kotlin is a new programming language, it is designed to interoperate fully with Java. It offers a more concise syntax for developers, but also, it can improve the quality of your app due that its null safety checks, by default it won’t allow...
SwiftUI by Marcos Pinet Swift UI was one of the most exciting announcements at WWDC 2019. This new framework makes it easier and faster for developers to build better user interface code with fewer errors, providing nearly automatic support for device capabilities...
The newest features of tensor flow by Claudia Elizabeth Garcia Gallegos TensorFlow is a Machine Learning cross-platform that has started to be adopted widely worldwide. Even though TensorFlow was just released by Google in 2015, it has grown from a software library of...
The new generation of mobile apps by Claudia Elizabeth Garcia Gallegos During Google I/O 2019, one of the most attractive announcements was about Augmented Reality. Each year, more people are getting access to technology, so the market for technology creators is...
Google launches Cloud Run by Jose Luis Vega Romero How to provide the right infrastructure to a project that scales well, is robust and secure are not straightforward tasks. Google Cloud has taken significant steps in delivering solutions where the supporting...
iPad Apps for Mac by Marcos Pinet Have you ever said: “this iPad App would be great on the Mac”? Before Xcode 11, the only way to accomplish that was to have two separate code bases, one for iPad, and one for Mac. This came with its entire set of issues to maintain,...
Machine Learning in Apple Ecosystem by Guillermo Reyes The scope of machine learning is just beginning to be imagined. The number of applications has increased at a humongous rate in the last years. Nowadays, almost all activity that includes data user analysis relies...
The new OS for iPad by Guillermo Reyes During the WWDC 2019 Apple revealed the new iPadOS, a specific OS to take advantage of the iPad characteristics and capabilities. Since iOS 9 multitasking capabilities have been present for the iPad with specific features such...
Machine Learning a help for humanity by Jose Luis Vega Romero Modern machine learning methods have been around for more than 10 years, but it seems that recently there is a trend to add machine learning to a wider range of applications including medicine, agriculture,...
GET IN TOUCH!