2

I know there is a limitation of 23 bytes in Android BLE.

There are several stackoverflow questions about sending more than 20 bytes.

But my question is, how to read more than 20 bytes with Android BLE.

Yes, it can be easily done with manipulating MTU, but Kitkat does not support requestMTU you know :(

With naive implementation,

override fun onCharacteristicRead(gatt: BluetoothGatt?, characteristic: BluetoothGattCharacteristic?, status: Int) {
    new String(characteristic?.value)
}

this only produce first 23 bytes.

  • Two options. Either your counterpart BLE device requests a higher MTU or you have to split your data into several messages (segmentation) – Christopher May 04 '17 at 13:02

1 Answers1

1

Take a look at this question.

Although if you do have control over the peripheral, you might want to chunk your data.

Community
  • 1
  • 1
Raymond
  • 2,276
  • 2
  • 20
  • 34