Could you help me? How could I check if user denyed bluetooth pairing reques开发者_运维百科t?
As soon as the user press Cancel on the Bluetooth Pairing Request Screen,
intent with action
android.bluetooth.BluetoothDevice.ACTION_BOND_STATE_CHANGED
is fired, and inside it, bundle with int key
android.bluetooth.BluetoothDevice.EXTRA_BOND_STATE
has value
android.bluetooth BluetoothDevice.BONE_NONE
For example, after registering broadcast receiver for the action, get int value like below. Then you will know if user pressed cancel on the pairing screen.
if (intent.getExtras().getInt(BluetoothDevice.EXTRA_BOND_STATE) == BluetoothDevice.BOND_NONE) {
}
you can't easily right now. Because the platform hides this from you the only option is to check the bonded devices list before and after
精彩评论