When working with Bluetooth beacons and/or gateways and looking at raw Bluetooth data it can often become confusing which device is which. When setting up beacons using manufacturers’ apps, it’s a common occurrence for our customers to mistakenly connect to smartphones or fitness trackers rather than a beacon and wonder why the connection doesn’t work.
RaMBLE is a useful Android app that helps decode the Bluetooth devices around you. It attempts to classify devices so you can identify them:
The scanning runs in background and also logs advertising so that the data can be exported for analysis.
PunchThrough has a comprehensive new guide about using Bluetooth on Android. It explains the basics of Bluetooth, introduces the Android Bluetooth API and provides a guide how to scan for devices and connect to them using Bluetooth GATT.
It also covers bonding, thread-safety, queuing requests, background services and 3rd party libraries.
A new version of Nordic Semiconductor’s Android BLE library has been released. Nordic is the manufacturer of the system on a chip (SoC) inside some Bluetooth devices. Connecting to these devices, as opposed to just scanning for their advertising data, can be very tricky and there are lots of different ways of doing things depending on the Android version and workarounds based on specific situations. Nordic’s Android library aims to solve these problems and claims it “makes working with Bluetooth LE on Android a pleasure”. The library uses standard Bluetooth and hence works for all Android Bluetooth development, not just Nordic’s devices.
The new Android BLE Library v2.2.0 adds GATT server support and tidies up the callback mechanism. GATT server is where the Android device itself can be connected to from another device as opposed to Android initiating the connection. Note that this library is all about Bluetooth GATT connections. Connections are rare in the BLE World as most information is obtained through non-connected scanning for Bluetooth advertising. Connections tend to be used for settings or where you need higher or larger throughput than advertising can provide.
Note that the library doesn’t include scanning which is required before you can connect. Nordic provides a separate scanning library.
Also be aware that these libraries are relatively large. When we used them they took us over the Android 64K method limit thus complicating development slightly. Also, the later versions have dependencies on AndroidX. Finally, while the libraries hide the complications of Android development, this can be good and bad. When problems happen, as they always do with Bluetooth GATT, if you didn’t write the workarounds in the first place, debugging and fixing can be difficult.
As more and more devices are being shipped with Android 10 we are increasing getting reports of problems with beacon apps built for previous versions of Android. We mentioned this issue back in October last year.
To compound the problem, many popular Chinese manufacturers such as Oppo, Huawei and Xiaomi also now using Android 10 in their forked versions of Android. Not only are these manufacturers inheriting the Android 10 problem but their devices also suffer from problems running services, such as Bluetooth scanning, in background. The problem is that these manufacturers also add their own additional background throttling (and killing) mechanisms into the OS that make Bluetooth unreliable. The site dontkillmyapp documents the known problems and some workarounds for various forks of Android.
If you think you might be a victim of these issues, try using another, perhaps older, Android smartphone to isolate the problem.
Bluetooth SIG have updated their Introduction to Bluetooth Beacons. It provides advice and examples how to use beacons from iOS, Android and Raspberry Pi using the respective Bluetooth APIs.
The examples show how to scan for AltBeacon which is unusual because most people will want to scan for iBeacon because AltBeacon is sent by very few beacons. This is less of a problem on Android and Raspberry Pi where slightly modified code can be used. However, on iOS, the suggested APIs won’t work for iBeacon because Apple removes the iBeacon data from the Bluetooth scan response data to force you to use the iBeacon specific APIs which aren’t mentioned in the guide.
We often gets asked what are the best beacons for iOS and/or Android. As mentioned in our post on Which Beacons Are The Most Compatible, all beacons, whether iBeacon or Eddystone, are compatible with iOS and Android.
The universal compatibility comes about because all beacons are slight derivations of a few standard circuit designs and firmware provided by Texas Instruments, Dialog and Nordic who produce the System On a Chip (SoC) inside beacons.
Instead, you should be looking at more physical aspects such as battery size, battery life, range, on-off buttons, waterproofing and included sensors.
There are a large number of offshore development companies currently spamming social media, claiming to do iBeacon development. We recommend you do your due dilligence before engaging development as many like to say ‘yes’ to anything and it’s often companies such as ours that have to pick up the pieces.
Here’s are some things to consider when looking for an iBeacon app developer:
Can they give examples of iBeacon apps they have written?
Can they give you references to past work who you can talk to?
Do they release development versions regularly so you can test and gauge progress? If everything is released at the end, it’s likely you are going to end up disappointed.
Who will actually be doing the development? There can be intermediaries in the development ecosystem that confuse and compound communications problems. Right from the start, you need to be talking direct with the person who will be doing the development.
Do they really understand you? Many aren’t native English speakers and if you are getting misunderstandings during initial engagement, this doesn’t bode well for the development.
Have they provided constructive comments on your proposed app rather than just saying ‘yes’? Developers should be able to improve on your ideas so as to get the best out of iOS and Android.
Getting iBeacon apps through Apple approval can be difficult. Can they give you examples why and the possible mitigations?
App development is an area where cheapest isn’t usually the best. Compromised development will cost you in the longer term through late or aborted development, tricky problems, significant end user support, poor app reviews and difficulty adapting the apps in the future for future phones and new features.
Beaconzone was founded by app developers in 2015 after we had previously created several iBeacon art gallery apps. We have since written many more iBeacon and Bluetooth LE apps on iOS and Android. Read about beaconzone.solutions
Nordic, the manufacturer of the System on a Chip (SoC) in most beacons, has a new blog post on Five Things You Didn’t Know About Nordic’s Mobile Development Apps. The post mentions less visible features of nRF Connect on iOS and Android. For example, you can get a useful RSSI graph by dragging the screen towards the right from the centre: