Android BLE peripheral with pin pairing

╄→гoц情女王★ 提交于 2021-02-10 06:51:18

问题


I am developing an Android app which behaves as Bluetooth peripheral role with a service.

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.

But how to enable PIN pairing?


回答1:


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.

The client/central side can force pairing by calling BluetoothDevice.creteBond().

The pairing method itself is determinated by the bluetooth protocol (see this thread)




回答2:


You dont actually require pairing to be done to transmit/receive data via ble, take a look into this tutorial



来源:https://stackoverflow.com/questions/40653579/android-ble-peripheral-with-pin-pairing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!