Android的蓝牙配对要求 [英] android Bluetooth Pairing request
问题描述
你能帮助我吗?我怎么会检查用户是否denyed蓝牙配对请求?
Could you help me? How could I check if user denyed bluetooth pairing request?
推荐答案
一旦用户preSS蓝牙配对请求屏幕取消,
As soon as the user press Cancel on the Bluetooth Pairing Request Screen,
意图与行动
android.bluetooth.BluetoothDevice.ACTION_BOND_STATE_CHANGED
android.bluetooth.BluetoothDevice.ACTION_BOND_STATE_CHANGED
被解雇,在它里面,捆绑INT键
is fired, and inside it, bundle with int key
android.bluetooth.BluetoothDevice.EXTRA_BOND_STATE
android.bluetooth.BluetoothDevice.EXTRA_BOND_STATE
具有值
android.bluetooth BluetoothDevice.BONE_NONE
android.bluetooth BluetoothDevice.BONE_NONE
例如,注册广播接收器的动作后,得到int值如下图所示。
然后,你就会知道,如果用户pressed配对屏幕上取消。
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) {
}
这篇关于Android的蓝牙配对要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!