Bluetooth classic is easy. Pair a device, then use it.
Bluetooth LE is a bit more difficult. The standard (4.0, 4.1, 4.2) offers different security features and bluetooth device use different subsets.
Succesful connection with Bluetooth LE devices highly depends on the combination of your Bluetooth device and Android version.
The Bluetooth LE standard uses the terms pairing & bonding differently than Android, where you get a pairing request for bluetooth bonding.
For simplicity I use the term pairing.
Bluetooth LE vendors
Most of the Bluetooth LE devices offering a serial service are based on these SoC:
- Texas Instruments CC2540, CC2541
- Nordic Semiconductor nRF51822, ...
- Microchip RN4870/71, BM70/71
The Bluetooth LE standard does not define a serial protocol, so each vendor defined their own GATT service + characteristic UUIDs.
This app knows the UUIDs used the devices above and allows custom UUIDs.
There are various complaints about the Android Bluetooth stack, e.g. here
about random disconnects.
In case of connection errors there are only strange error codes without description
HM-10 clone (CC41-A, BT05, ...) issues
There are different clones of the HM-10 device, typically sold under the original name.
The original device uses AT commands without line feed, whereas the clones use line feed and have less and slightly
different AT commands.
you can find a comparison and the data sheets.
Somewhere i read that these devices use an outdated TI library causing pairing problems.
Successfully using the clones is a game of luck, as there are several issues:
Security mode AT+TYPE1/2/3 for pairing with Pin
- works on on some Android / BLE device combinations
- sometimes pairing dialogs only pop up in the background
- changing the TYPE is only effective after BLE device reboot
- Pairing has to be done in the app, whereas it typically is done in Android Bluetooth Settings.
- sometimes needs BLE device reboot, ...
- sporadic connection loss
- There are different clones (look here), so your result may vary
Stricter SCAN filter in Android 8.x
- With Android 8.x these devices are not shown in the SCAN result as they provide a malformed result.
- The devices are shown again with Android 9.0
If you have results for other devices, please contact me at firstname.lastname@example.org