Android的蓝牙配对要求 [英] android Bluetooth Pairing request

查看:253
本文介绍了Android的蓝牙配对要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能帮助我吗?我怎么会检查用户是否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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆