Update: I have turned the below class into an app which I’ve made available in the Google Play Store called Bluetooth Class Zero. It is a simple application which just enables pairing with bluetooth class zero devices without having to root & patch your phone.
I bought a Bluetooth Bee from Seeed Studios, which is an SPP (Serial Port Profile) bluetooth device, with the intention of writing an app for Android that communicates with a remote data logger. Unfortunately, it turns out that there’s a bug in the BroadComm bluetooth stack that is used by most Android phone manufacturers (LG, HTC, Samsung are affected, but not the Google Nexus phones) that prevents discovery to this and all other bluetooth devices that report their Class of Device (CoD) code as 0x00. This is the case for many SPP bluetooth devices, and SPP is probably the most common bluetooth profile (at least it’s the most basic – just straight serial comms) so this bug is pretty nasty.
Basically, if you perform a scan for devices, your SPP device will not show up, and in the logs you will see:
ERROR/DTUN_HCID4(663): Device [00:18:E4:0C:6E:CA] class is 0x00 – skip it.
The code for the Broadcom bluetooth stack is open source, so the bug is plain for all to see here. The bug has been reported on StackOverflow and elsewhere.
Until Broadcom and/or all users of their bluetooth stack fix this issue (by simply removing the IF block that skips devices whose CoD is 0x00), the only way to connect to your SPP device from Android is to read the log files, looking for the above error, extract the device address, and manually initiate a connection in code. After this, your SPP device will appear along with all your other bluetooth devices in the bluetooth settings page on your phone, and you can successfully communicate using the bluetooth API provided by Google.
I have written a re-usable class that implements this workaround, which you can download from here.
How to use (from your Activity class):
Where BluetoothDiscoveryCallback is a class defined e.g. in your Activity. The call method will be called after the discovery task completes, and is passed the complete list of paired bluetooth devices, including those that are undiscoverable due to the above bug.
private class BluetoothDiscoveryCallback
public void call(ArrayList<BluetoothDevice> devices)
// Now you have the list of ALL available devices,
// including those that report class 0x00.
// Java equivalent of the built-in Action from C#.
public interface Action<T>
void call(T target);
You’ll also need to add READ_LOGS permission to your manifest file:
<uses-permission android:name="android.permission.READ_LOGS" />
Feel free to suggest improvements to the code, I’m new to Android and haven’t done Java in ages 🙂
P.S. Hassle your phone manufacturer to fix this bug so this workaround is not needed!
After pressing “Start Discovery”, if any bluetooth class zero devices were found (but ignored), you will get the standard pairing dialog:
After entering the correct PIN code, your device will be listed alongside others in your bluetooth settings:
The app requires Android 2.1+. It’s been tested on the following phones:
The app is free to use, if you find it useful, feel free to make small donation 🙂