If a MTU negotiation is only performed by the peripheral, the onMtuChanged method is not invoked. According to your documentation, in that case, android.bluetooth.BluetoothGattServerCallback#onMtuChanged(BluetoothDevice, int) should be used instead. However, the following method in MainThreadBluetoothGattCallback which extends from BluetoothGattCallback is not invoked either:
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public final void onMtuChanged(@NonNull final BluetoothGatt gatt,
@IntRange(from = 23, to = 517) final int mtu, final int status) {
runOnUiThread(() -> onMtuChangedSafe(gatt, mtu, status));
}
Isn't it possible to get the negotiated MTU without requesting a change?
If a MTU negotiation is only performed by the peripheral, the
onMtuChanged
method is not invoked. According to your documentation, in that case,android.bluetooth.BluetoothGattServerCallback#onMtuChanged(BluetoothDevice, int)
should be used instead. However, the following method inMainThreadBluetoothGattCallback
which extends fromBluetoothGattCallback
is not invoked either:Isn't it possible to get the negotiated MTU without requesting a change?