Q:

Android/Java - Is it necessary on android's side to request a MTU update?

I have wrote firmware for a BLE device, and it is expecting 40 bytes when receiving a packet.
My question is: Is it necessary to receive the event "onMtuChanged()" for my android device to send more than 23 bytes? In other words, does this callback ALLOW my device to send more than 23 bytes?
Secondly, is there a way for me to internally set the MTU size within android so that I don't have to request the MTU exchange? My BLE devices disconnect after receiving data (part of a mesh network), so I have to exchange MTU requests every time I send data. It slows down transmission considerably.

A:

To be allowed to transfer more than the default MTU, a new MTU must be negotiated. Sending larger packets without having exchanged a larger MTU is forbidden according to the specification. You can either initiate the MTU change from Android side (as you already found out) or from the peripheral side (in which case Android won't give you any callback).
If you don't like the extra roundtrip it takes to do this, why don't you just send two Write Without Response packets? That would fit 40 bytes and can be sent during a single connection event.

