iBeacon Android with the MOKOSmart SDK
The iBeacon protocol developed by Apple based on Bluetooth Low Energy is supported by a variety of devices. The article explains iBeacons and Bluetooth Low Energy and uses the example of developing an Android app for location-dependent shopping lists to show the location-dependent interaction of an app with iBeacon android. The implementation is based on MokoBeacon and the associated SDK.
iBeacon, Bluetooth 4.0, BLE, SMART. Wot?
The basic technology for iBeacon is Bluetooth. Bluetooth Low Energy (BLE), which is often referred to as the Bluetooth Smart marketing label, has been included in version 4.0 of the Bluetooth standard. BLE is not backward compatible with previous versions called Bluetooth Classic. Bluetooth 4.0 specifies that standard-compliant devices must implement one or both variants, i.e. Low Energy or Classic.
BLE is implemented on almost all current smartphones such as the iPhone 4+ and the Samsung Galaxy 3+. An iPhone can function both as a receiver of iBeacon signals and – unlike iBeacon Android – as a beacon itself. Android includes BLE drivers from API version 18, i.e. Android 4.3. Incidentally, current computers are also BLE-capable. In Windows, however, the drivers are only on board from Windows 8 and since around mid-2011 BLE has been available on Apple computers.
BLE continues to support a variety of peripheral devices such as heart rate monitors and toy helicopters, thermometers, fitness equipment and toothbrushes, yes, toothbrushes and sneakers.
iOS and Android with the first iBeacon apps
IOS 7 currently offers developers the best prerequisites for integrating iBeacon into apps. Since iOS 7, the operating system even starts apps that are no longer in memory if it has discovered an iBeacon registered by them or loses its signal. Registration for this takes place via the core location framework, which is easier to use than core Bluetooth. The most well-known iBeacon android and iOS app are MokoBeacon. It takes action when selected events occur. For example, it creates a calendar entry when you come home.
Android does not support iBeacon ex-works. Several third-party vendors compete for developer favor with their solutions, including Radius Networks and Sensorberg. The free Radius Networks solution consists of a program library that Android provides with an iBeacon service and the necessary API.
Sensorberg relies on a complete package consisting of hardware, software development kit and software for the management of the iBeacons, the app content and user interactions. The Sensorberg solution was used, for example, in the app for Cebit 2014, which is available for iBeacon Android and iBeacon iOS. The app provided training places, internships and a job offer on the smartphone at selected trade fair locations.
Information quality and data protection are crucial for success
On the consumer side, iBeacon arouses the fear of a smartphone spammed with advertising, of intrusive, individualized customer contact, as in the Minority Report. Some of these concerns are unjustified, as the iBeacon android function, which inevitably serves as a reference, shows. iBeacon uses an opt-in model. You only become a user by installing an iBeacon app; all other smartphone owners are spared.
IOS also only discreetly indicates information triggered by iBeacon. They appear when the user switches on his smartphone while he is within range of the beacon and disappears when he moves away from it. No interference from beeps and vibrations or even an overflowing message center after visiting a shopping center.
When users find an iBeacon app useful and when it annoys them will largely determine the quality of the information and functions provided. Oelling explains: “Location services, not location marketing”. Accordingly, only apps with utility will be successful. Annoying apps fly off the phone, negative reviews do the rest.
What can I do with an iBeacon android?
The iBeacon can e.g. be used to identify certain positions such as “work” or “home”. Predefined actions can then be triggered in the smartphone. E.g. the WLAN can be switched on and off automatically when the user leaves or enters their home.
With various apps, these functions can also be implemented based on GPS data or cell towers, but both alternatives have disadvantages. GPS tracking uses a lot of energy and does not work in buildings. The location with cell towers is not exactly accurate. In rural areas, a cell tower may be visible for several kilometers. With iBeacons, it is only a few meters. It can even be used to identify individual rooms within a house. As a last resort, there would still be WLAN, since it also broadcasts its SSID regularly. Unfortunately, this fails because the cell phones switch off the WLAN hardware to save energy, but not the Bluetooth receiver.
Configure MkiBeacon Parameters
For this article, we use MkiBeacon. The iBeacon is simply plugged into any USB port. It does not have to be a PC since only the voltage is required.
The following app is installed on the smartphone for configuration:
After starting the app, all iBeacons are displayed nearby. If there are several, it is probably the one with the shortest distance. After clicking on your own iBeacon, the configuration view opens:
The following settings can be adjusted:
The actual ID of the iBeacon. In practice e.g. all Vodafone Beacons have the same UUID. In this way, there is no need to maintain a list of valid beacons in the app. The shop can then e.g. Be identified via major and minor.
Major / Minor:
The idea is that all shops get the same UUID. Major could be used to identify the department (electronics, clothing, delicatessen, ..). Minor would then be used, for example, to identify the shelf (“keyboards” shelf in the “Electronics” department).
Here the transmission strength can be set in 7 steps. It’s best to try it out a bit. The distances are of course estimates.
Indicates how often the iBeacon sends its ID. In this case, 1 means 100 milliseconds.
Serial number. It can be adjusted.
The name and serial number together form the name with which the iBeacon can be identified. But the UUID is more important.
This can prevent you from changing the settings. If the value is 1, you have locked yourself out, but the beacon continues to work.
A password can be set here.
After changing settings, the iBeacon must be restarted. The old password is required for this.
After changing a value, click on Save at the top right. It always took me about 1 second, although the change was not yet transferred to the iBeacon. When everything has been changed, a click on Reboot iBeacon opens the following dialog:
This step is important, otherwise, the changes will not be accepted. I don’t know what the catch is for, but I put it. The first time the Moko4321 password set at the factory must be entered here. Otherwise, the process will fail without any error message 🙁 Of course, the second time, your own password will be used.
IBeacon technology offers an ideal way to trigger location-dependent actions on the mobile phone. Due to the low cost and low energy consumption, several beacons can be used without any problems. Since the beacons distinguish between three distance ranges, actions can also be triggered if the smartphone is located directly next to the beacon (e.g. at the bed).
Even though the app is a bit junky, the beacon makes a good impression. The app works and is only required once for the initial setup. The transmission power may have to be adjusted at the beginning – depending on the application.
For at home, I would choose a non-battery-powered solution, as they have fewer range problems because there is no need to spare the battery. If you want to automatically set your cell phone to silent after entering the forest, you should, of course, use battery-powered devices. These usually last longer than a year.
iBeacon technology: micro-location smartphones and tablet apps
As the name suggests, the iBeacon technology was introduced by Apple in 2013. Beacons are small radio transmitters that can be installed, for example, in a shop or in a museum and send certain information to customers or visitors. BLE (Bluetooth Low Energy) is used here. This is not a new technology but already occurs in pulse watches, for example. However, radio transmitters do not have a very long range. However, beacons do not contain any other technology that the mobile device or the user can personally recognize or even monitor. An app that supports iBeacon is also required. If no app for the technology is installed on the mobile device, the smartphone, for example, does not react to an iBeacon installed in the store.
How iBeacons / beacon work
If a corresponding app is installed and the device comes close to a beacon, the system activates the app. To do this, the app receives a signal from the beacons and thus knows that there is a certain iBeacon nearby. What happens in detail is always different, depending on the app and operator. In some cases, for example, only one message is displayed, in other offers or vouchers are presented. Each iBeacon has a specific identifier, also called UUID (Universally Unique Identifier) in technical jargon. With this, the app can also search for further information via the Internet and display it to the user.
However, the apps can not only recognize the beacons in their vicinity, but they can also determine how far they are from the respective handheld. There are three different distances:
1. Far (distance “far”)
This means a distance of approx. 2m – 20m. For example, information about nearby shops is sent to the smartphone.
2. Near (distance “near”)
Here the distance is about 0.5m – 2m. If you enter a store, for example, the app welcomes the user.
3. Direct (distance “immediate”)
This means direct proximity. For example, if the user is standing directly in front of a painting in a museum, the app can provide specific information about the art object.
In addition, it must be said that the determination of the distance is already relatively good, but not exactly. The exact position can deviate a few meters from the exact location.
iBeacons = Apple – What is there comparable for iBeacon android?
As already mentioned, Apple introduced iBeacon. For developers, iOS8 is the best environment for integrating iBeacons into apps. But iBeacon can also be used on Android devices. However, this does not go naturally. However, there are several providers that provide different solutions for this.
A well-known and free solution comes from Radius Networks, for example. A program library is provided here, consisting of the API required for using iBeacon and an iBeacon service.
Sensorberg presents another solution. With the package of hardware, software development kit and software for the management of the iBeacons, the content of the app and the interaction of the users, everything is included that is needed for the implementation.
However, it must be ensured that the smartphone or tablet supports BLE technology and has a compatible chip. This is already guaranteed at Apple from the iPhone 4S. But many of the Android devices already carry such a chip. Like the HTC One, the Google Nexus 4, 5, 7 and 10 and the Samsung Galaxy smartphone from S3.
However, not only the hardware is crucial, but also the software. BLE from version 5 is supported on iOS. With Android only from version 4.3. If the hardware is correct, but the software is not, there are solutions such as custom ROMs to upgrade the smartphone or tablet.