Search code examples
rx-androidrxandroidble

RxAndroidBle scanBleDevices(UUID...) not firing


I am having trouble using the scanBleDevices method when passing it a (valid) UUID - the subscribe will never fire. Currently I have a working prototype using the usual android methods of scanning, connecting, read/write, but I want to update my syntax of RxAndroidBle to make things more safe and more easy to read.

Here is my RxAndroidBle implementation - not working / subscribe never fires:

enter image description here

You may be thinking that my UUID is wrong, but here is some alternative implementation that I did using a very stateful previous version - same uuid, this works:

enter image description here

mLeScanCallback will be fired.

I am using RxAndroidBle version 1.2.2 & my phone is a Nexus 6P android version 6.0.1

Some additional info: If I use scanBleDevices(), no parameters, I can find my desired rxBleScanResult by checking something in the manufacture data, which I will be doing anyway. But I would like to filter on the UUID too to be safe. When I had found my desired package bytes[] I tried to extract my UUID using the (deprecated) new UUIDUtil().extractUUIDs(rxBleScanResult.getScanRecord()), but this returned an empty list. And just to nail things down a little more, when I use the old fashioned mLeScanCallback, the above extractUUIDS is also resulting in an empty list.

Thanks for your time!


Solution

  • This is actually a bug in the RxAndroidBle library. As one could see in the UUIDUtil (https://github.com/Polidea/RxAndroidBle/commit/ee59e0ab9ae3c483f5c4f35c7729e9fc2068ee21#diff-c7944d4c01c56adf4e6c67c7f7f737e8) — which is responsible for extracting service UUIDs from bluetooth advertisement — it was lacking of 32-bit UUIDs. The fix is added in a just released version 1.2.3.