Android Question Detect bluetooth pairing request response?

Arf

Well-Known Member
Licensed User
Longtime User
Hi,
Is there a way I can intercept when a user has clicked OK to accept a bluetooth pairing dialog?

Maybe this below, but I don't know if this applies to Bluetooth 2.1 or BLE only (I use 2.1), and bonding is BLE terminology. I already have a service set up to intercept the PAIRING_REQUEST event which occurs when the dialog is presented.

If StartingIntent.Action = "android.bluetooth.device.action.BOND_BONDED" Then
 

Arf

Well-Known Member
Licensed User
Longtime User
Ok, I'm not getting an event for BOND_BONDED or BOND_BONDING. I am not sure if the intent name is correct or not.
Here's what's in my manifest editor to allow the bonding related intents through:

AddReceiverText(BTPair,
<intent-filter>
<action android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
<action android:name="android.bluetooth.device.action.BOND_BONDING" />
<action android:name="android.bluetooth.device.action.BOND_BONDED" />
</intent-filter>)
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
I've also tried:
Else If StartingIntent.Action = "android.bluetooth.device.action.ACTION_BOND_STATE_CHANGED" Then

but no cigar.. I don't very much about intents, but I was wondering if maybe the ACTION_ in the last part of the above means that the string should actually be:
Else If StartingIntent.Action = "android.bluetooth.device.ACTION_BOND_STATE_CHANGED" Then

could an incorrect intent string be why I'm not intercepting these events?
 
Upvote 0
Top