可以自动接受蓝牙配对吗?
在使用 createInsecureRfcommSocketToServiceRecord() API 的 Android 2.3.3 BluetoothChat 示例中,即使没有提供 PIN 码,系统仍会提示用户接受配对请求。
有没有一种方法可以在无需用户干预的情况下自动执行蓝牙配对请求?或者出于安全考虑这永远不可能?我在网上查了两天了,没有找到太多,所以如果有人知道,请留言。
谢谢!
In the Android 2.3.3 BluetoothChat example with with createInsecureRfcommSocketToServiceRecord() API, users are still prompted to accept the pairing request, even though no PIN code is presented.
Is there a way to automate Bluetooth pairing request without user intervention? Or is this never possible due to security concerns? I have been looking online for 2 days now and haven't really found much, so if anybody knows, please post.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
所以,我有这个提示,如果有人需要在 android 4.4.2 中工作的答案
中的代码
以及接收器、清单文件
和广播接收器
So, I had this cuestion, if some one needs the answer to this working in android 4.4.2
and the code for the Receiver
and in the manifest file
and the broadcastReceiver
对于标准 API 来说不行:如果 MAC 地址尚未存在于配对数据库中,则始终会出现提示。有人告诉我,如果您有一个已 root 的设备并且对蓝牙服务的 DBus 端点具有公共读/写访问权限,您可以解决这个问题,但我从未见过实际实现的。
Not with the standard API, no: if the MAC address is not already in the pairing database there will always be the prompt. I'm told that if you have a device that has been rooted and have public read/write access to the bluetooth service's DBus endpoint you can work around that but I've never seen that actually implemented.
我遇到了同样的问题,希望以下代码能有所帮助:
首先我们需要:
<意图过滤器>
其次,我们需要 BluetoothDevice 类,并且:
i came across the same problem, i hope the following code will help:
firsly we need:
<receiver android:name=".broadcast.PairingRequest">
<intent-filter>
<action android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
<action android:name="android.bluetooth.device.action.PAIRING_CANCEL" />
</intent-filter></receiver>
secondly we need the BluetoothDevice class, and: