带引脚配对的Android BLE外设 [英] Android BLE peripheral with pin pairing
问题描述
我正在开发一个Android应用程序,该应用程序充当服务的蓝牙外围设备角色.
I am developing an Android app which behaves as Bluetooth peripheral role with a service.
当我开始做广告时,其他正在搜索提供此服务的设备的Android设备可以看到我的设备(并且可以与之配对而不用别的针)-好的.
When I start advertising, other Android devices searching for devices offering this service, can see my device (and can pair to it without pin) - ok.
但是如何启用PIN配对?
But how to enable PIN pairing?
推荐答案
You can force the device has to be paired, when using specific characteristics by protecting them with PERMISSION_READ_ENCRYPTED_MITM or PERMISSION_WRITE_ENCRYPTED_MITM.
客户端/中央端可以通过调用 BluetoothDevice来强制配对.creteBond().
The client/central side can force pairing by calling BluetoothDevice.creteBond().
配对方法本身由蓝牙协议决定(请参见此线程)
The pairing method itself is determinated by the bluetooth protocol (see this thread)
这篇关于带引脚配对的Android BLE外设的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!