11

I'm writing an Android application that connects to a physical device via BLE. Android app will act as peripheral role while the device is central. Device I/O Capabilities is also set to NoInputNoOutput (ble_cmd_sm_set_parameters(0, 8, sm_io_capability_noinputnooutput))

The flow to set up connection is:

  • Open Android app, then open a Bluetooth Gatt Server connection via bluetoothManager.openGattServer()
  • Add BluetoothGattService into that BluetoothGattServer (herein that service contains some characteristics with property Indicate & Notify, permission Read & Write)
  • After adding all services, then start sending advertising
  • Touch on a button on the device to let it starts scanning for peripheral.
  • When detecting the phone, the device will send a Pairing signal to phone.
  • Receiving that signal, in theory, Android device will show a Pairing dialog with 2 buttons PAIR and CANCEL to confirm that pairing (this is mode JustWorks instead of Passkey because it doesn't require us to use a keyboard to enter key).
  • However, after testing in several Android devices, some has that dialog such as Moto Z (Android 6), Moto G (Android 6) while others don't have such as Galaxy S7, Galaxy Tab S2 (both Android 7). I use WireShark to capture and analyst Bluetooth package of these device and realize the former has Sent Pairing Request: AuthReq with Secure Connection Flag = 1 while the latter has Secure Connection Flag = 0 (For more information about Secure Connection flag, please refer to Bluetooth Pairing Part 4)

When reading output from Android Studio logcat (in case Samsung devices), I get these log: 01-31 15:21:53.322 D/BluetoothAdapter: isSecureModeEnabled 01-31 15:21:53.322 D/BtConfig.SecureMode: isSecureModeOn:false 01-31 15:21:53.325 D/BluetoothAdapter: STATE_ON 01-31 15:21:53.325 D/BluetoothLeAdvertiser: start advertising Not sure if SecureMode same as SecureConnection that we're mentioning.

As my understanding, that pairing is BLE Secure Connections, with JustWorks mode. But it seems not all Android devices support it (Could you please confirm my thought?). Or, how can we force latter devices to have Pairing dialog too?

One important thing is, I have an iOS app with the same connection flow and the same physical device, and it does show the Pairing dialog.

anticafe
  • 6,816
  • 9
  • 43
  • 74
  • You don't need to repeat the `android` **tag** in the post **title**. – Phantômaxx Jan 31 '18 at 10:15
  • The samsung phones are rooted? if so try to disable knox, if not try and use a rooted samsung device and see if it acts differently when u disable knox – crazyPixel Feb 09 '18 at 00:00

0 Answers0