android蓝牙配对请求

vic*_*vic 2 android bluetooth

你可以帮帮我吗?如何检查用户是否拒绝蓝牙配对请求?

小智 5

一旦用户在蓝牙配对请求屏幕上按下取消,

意图与行动

android.bluetooth.BluetoothDevice.ACTION_BOND_STATE_CHANGED

被解雇,并在其中捆绑了 int 键

android.bluetooth.BluetoothDevice.EXTRA_BOND_STATE

有价值

android.bluetooth BluetoothDevice.BONE_NONE

例如,在为动作注册广播接收器后,获取如下所示的 int 值。然后你就会知道用户是否在配对屏幕上按下了取消。

if (intent.getExtras().getInt(BluetoothDevice.EXTRA_BOND_STATE) == BluetoothDevice.BOND_NONE) {
}
Run Code Online (Sandbox Code Playgroud)