I want to use Android BLE to receive more than 20 bytes one package, but it does not work. So I tried BluetoothGatt.requestMtu()
. It returns true, but is not working. I know the MTU exchange request can only be initialized by client, that is an Android phone. I do not understand why this API is not working.
The phone I use is an OnePlus 6 with Android 8.1
Asked
Active
Viewed 3,394 times
1
-
To what are you setting the MTU? Too high values will always fail. That method will always return true if you have a connection, but real success is only when you get a call to onMtuChange: https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback.html#onMtuChanged(android.bluetooth.BluetoothGatt,%20int,%20int) Your phone is sure capable of MTUs of at least 200 (tested with mine) but still you need the other device to be capable of that too – nsndvd Oct 10 '18 at 08:34
-
BLE is only for a small amount of data. So you had to split the 20 Bytes or use classic Bluetooth – Mike Oct 10 '18 at 08:53
-
onMtuChange also returns true. I also use iphone X to test longer mtu, it works well because it initialized the mtu exchange request. – lite xu Oct 10 '18 at 10:10
1 Answers
2
It is not related to Android framework API. It belongs to Bluetooth BLE specification. Please check more details here. Maximum packet length for Bluetooth LE?

Quang Nguyen
- 2,600
- 2
- 17
- 24