Arf Well-Known Member Licensed User Longtime User Sep 28, 2017 #1 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
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
Erel B4X founder Staff member Licensed User Longtime User Sep 28, 2017 #2 Official documentation: https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#BOND_BONDED As it was added in API 5 (Android 2.0) it is relevant for classic Bluetooth. Upvote 0
Official documentation: https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#BOND_BONDED As it was added in API 5 (Android 2.0) it is relevant for classic Bluetooth.
Arf Well-Known Member Licensed User Longtime User Sep 28, 2017 #3 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
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>)
Arf Well-Known Member Licensed User Longtime User Sep 28, 2017 #4 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
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?
Erel B4X founder Staff member Licensed User Longtime User Sep 29, 2017 #5 Try it with: Code: Copy AddReceiverText(BTPair, <intent-filter> <action android:name="android.bluetooth.device.action.BOND_STATE_CHANGED"/> </intent-filter> ) Note that there are broadcast intents that can only be intercepted with a dynamic filter. You can create dynamic filters with the BroadcastReceiver library. Upvote 0
Try it with: Code: Copy AddReceiverText(BTPair, <intent-filter> <action android:name="android.bluetooth.device.action.BOND_STATE_CHANGED"/> </intent-filter> ) Note that there are broadcast intents that can only be intercepted with a dynamic filter. You can create dynamic filters with the BroadcastReceiver library.