IBeacon Android with the MOKOSmart SDK
Протокол iBeacon, разработанный Apple на основе Bluetooth Low Energy, поддерживается множеством устройств. 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, СТАЛИ, УМНАЯ. Знают?
Базовая технология для iBeacon - Bluetooth. Bluetooth Low Energy (СТАЛИ), который часто называют маркетинговым лейблом Bluetooth Smart, был включен в версию 4.0 стандарта Bluetooth. BLE не имеет обратной совместимости с предыдущими версиями Bluetooth Classic. Bluetooth 4.0 указывает, что стандартные устройства должны реализовывать один или оба варианта, т.е.. Низкая энергия или Классика.
BLE реализован практически на всех современных смартфонах, таких как iPhone 4+ и Samsung Galaxy 3+. IPhone может функционировать как приемник сигналов iBeacon и – unlike iBeacon Android – as a beacon itself. Android включает в себя драйверы BLE из версии API 18, т.е.. Android 4.3. между прочим, современные компьютеры также поддерживают BLE. В винде, тем не мение, драйверы только на борту от винды 8 and since around mid-2011 BLE has been available on Apple computers.
BLE продолжает поддерживать различные периферийные устройства, такие как мониторы сердечного ритма и игрушечные вертолеты, термометры, фитнес-оборудование и зубные щетки, да, зубные щетки и кроссовки.
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. Например, 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, например, 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”. Соответственно, 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” или “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. К сожалению, this fails because the cell phones switch off the WLAN hardware to save energy, but not the Bluetooth receiver.
Configure MkiBeacon параметры
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. В этом случае, 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.
Крупный / Незначительный:
The idea is that all shops get the same UUID. Major could be used to identify the department (электроника, clothing, delicatessen, ..). Minor would then be used, например, 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. В таком случае, 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. В противном случае, 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 (например. 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: 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, например, in a shop or in a museum and send certain information to customers or visitors. СТАЛИ (Bluetooth Low Energy) is used here. This is not a new technology but already occurs in pulse watches, например. тем не мение, radio transmitters do not have a very long range. тем не мение, 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, например, 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. Сделать это, 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, например, 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.
тем не мение, 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. далеко (расстояние “далеко”)
This means a distance of approx. 2м – 20м. Например, information about nearby shops is sent to the smartphone.
2. Возле (расстояние “возле”)
Here the distance is about 0.5m – 2м. If you enter a store, например, the app welcomes the user.
3. Direct (расстояние “немедленный”)
This means direct proximity. Например, if the user is standing directly in front of a painting in a museum, the app can provide specific information about the art object.
К тому же, 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?
Как уже упоминалось, Apple introduced iBeacon. For developers, iOS8 is the best environment for integrating iBeacons into apps. But iBeacon can also be used on Android devices. тем не мение, this does not go naturally. тем не мение, there are several providers that provide different solutions for this.
A well-known and free solution comes from Radius Networks, например. 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.
тем не мение, 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 и 10 and the Samsung Galaxy smartphone from S3.
тем не мение, 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.