I am a complete newbie in the Android world. Please forgive me if my question is too naive.
I am working on an example application for implementing Bluetooth pairing between the Linux Box (FC-21 with Bluez-5.42) and Android tablets. I use NFC to transfer the Bluetooth name, address and OOB data from an Android PC. I can send the above data from a PC to Android via NFC (beam for sure), and I can parse and decode all the data on the Android side. With the Bluetooth address in the Linux box available on Android, I can call CreateBond () to connect the Android tablet to the Linux Box. I tested this part and it works as expected.
Now the problem with this method is that during Bluetooth pairing, digital matching or key association is used, which in my opinion is an aberration for the user when he uses NFC for pairing. Since I already have OOB data on my PC, I would like to use the OOB association for pairing so that the user interface is not compromised.
For this, when I replace CreateBond () with CreateBondOutOfBand () [using reflection], the connection request is not sent from Android to the Linux PC.
try { showLog("Pairing started"); Method m = bDev.getClass().getMethod("createBondOutOfBand", byte[].class, byte[].class); showLog("Found method"); Boolean flag = (Boolean) m.invoke(bDev, Hash, Rand,(Object[]) null); //Method m = bDev.getClass().getMethod("createBond", (Class[]) null); //Boolean flag = (Boolean) m.invoke(bDev, (Object[]) null); if(flag) showLog("Pairing successfully finished."); else showLog("Pairing failed"); } catch (Exception e) { showLog("Pairing failed."); }
I searched the Internet, but did not find any concrete evidence that the OOB connection could be implemented in Android.
In addition, to test the behavior of my own Android, I created an NFC tag with the Bluetooth name, address and OOB data in the Linux box. When I held the tag against an Android tablet, pairing of Bluettoth was started, but it still did not use the OOB association model.
My questions are as follows:
- Is the OOB association model supported on Android?
- If the OOB association model is supported, is the CreateBondOutOfBand () API created to use, or is there any other API I need to use?
Any input is welcome.
Thanks,
Sai