Dawg85
Dawg85

Reputation: 71

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?

Upvotes: 4

Views: 3510

Answers (2)

Myon
Myon

Reputation: 957

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)

Upvotes: 4

SaravInfern
SaravInfern

Reputation: 3388

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

Upvotes: 0

Related Questions