I have an app where I am programmatically controlling Bluetooth pairing and unpairing. I can pair before connection and unpair afterwards. The reason I need to do this is specific to my application and not in the scope of my question.
Basically what I am doing is:
- Get a reference
ib
toIBluetooth
object as described in this answer - Register a BroadcastReceiver for
android.bluetooth.device.action.PAIRING_REQUEST
- Call
ib.createBond(address)
- Wait for BroadcastReceiver to trigger
- Convert user pin into bytes with convertPinToBytes()
- Call
ib.setPin(address, pinBytes)
from within BroadcastReceiver
Anyways, this approach works great, except for the fact that when I do the pairing, I get a notification in the Status bar requesting that the user enter a PIN to complete the pairing. But this is in fact unnecessary, because by the time the user sees this, my app has already used setPin()
. I'd really like for that notification to either a) not appear at all, or b) be dismissed automatically somehow.
I realize this may not even be possible, but I thought I would ask in case someone has a creative idea.