Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android BLE peripheral with pin pairing

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?

like image 620
Dawg85 Avatar asked Sep 06 '25 23:09

Dawg85


1 Answers

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)

like image 128
Myon Avatar answered Sep 10 '25 00:09

Myon