Create Smart Geofencing Mobile Apps in iOS 7+

by Oct 2, 2013#iOS

Printer Icon
f

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.

Geofencing in Retail Stores

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.

Beacons in Grocery stores

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.

Beacons in Museums

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.

AppStore integration based on Location

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).

Home automation using Geofencing

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).

Geofencing for Security

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.

Traffic Control with Geofencing

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.

About Us: Krasamo is a mobile app development company focused on the Internet-of-Things and Digital Transformation.

Click here to learn more about our mobile development services.

RELATED BLOG POSTS

iPadOS 16 Features Overview 2022

iPadOS 16 Features Overview 2022

During the WWDC 2019 Apple revealed the new iPadOS, a specific OS to take advantage of the iPad characteristics and capabilities.

Apple App Development Updates 2024

Apple App Development Updates 2024

Check the latest news on Apple’s Worldwide Developers Conference (WWDC) and their latest technologies for developers to use in building apps for the App Store.

iOS App Phased Release Overview

iOS App Phased Release Overview

A phased release or rollout is an app version update released in stages to a percentage of users to address issues and bugs in a controlled environment.