0

I have a raspi3 with android things on it and I want to connect to a BLE device that requires a user authentication for bounding.

On a phone, after having set a characteristic on the BLE device, I am able to receive the Broadcast event

BluetoothDevice.ACTION_PAIRING_REQUEST

and in the meantime a dialog from android system opens asking me to accept the bluetooth connection (it has pairing variant = 3 (PAIRING_VARIANT_CONSENT)). When I accept it on the dialog everything goes nice and I connect to the device.

In my android things device I don't receive any ACTION_PAIRING_REQUEST event and my connection drops as soon as I write the characteristic on the BLE device. Is there any way to have the accept process on android things?

Manuela
  • 462
  • 6
  • 18

1 Answers1

2

You can use the Android Things BluetoothConnectionManager to initiate device pairing or respond to incoming pairing requests with a BluetoothPairingCallback. See the Bluetooth API guide for more details on device pairing.

devunwired
  • 62,780
  • 12
  • 127
  • 139
  • 1
    Note that in the current preview release, not all pairing variants are supported. See the release notes for known issues: https://developer.android.com/things/preview/releases.html – devunwired Mar 08 '18 at 21:30
  • Thanks, yeasterday I found the code and tried it but something is missing again: on phone side when I am asked to confirm the pairing the dialog has a checkbox to be checked requesting "Allow that device blablabla to access to your contacts and to the calls history". I'm still not able to replicate the checkbox acceptance in android things because simply using "mBluetoothConnectionManager.finishPairing(bluetoothDevice);" doesn't complete full pairing with the device – Manuela Mar 09 '18 at 08:55