I'm trying to pair a device using Bluetooth. Sometimes pairing is working fine. but, sometimes createBond() function returns false. How to find the reason for the failure?
if(!device.createBond()){
// want to find the reason for the failure
}
This negative result can be caused when calling createBond() on an already bonded device. Remember that bonded does not mean connected, bonded means paired. Check if your device bluetooth settings already has a known configuration for the device you are trying to connect to. If so, deleting the Bluetooth configuration and then doing createBond will fix the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With