Share via


BluetoothGatt.RequestMtu(Int32) Method

Definition

Request an MTU size used for a given connection.

[Android.Runtime.Register("requestMtu", "(I)Z", "")]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public bool RequestMtu (int mtu);
[<Android.Runtime.Register("requestMtu", "(I)Z", "")>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.RequestMtu : int -> bool

Parameters

mtu
Int32

Returns

true, if the new MTU value has been requested successfully

Attributes

Remarks

Request an MTU size used for a given connection. Please note that starting from Android 14, the Android Bluetooth stack requests the BLE ATT MTU to 517 bytes when the first GATT client requests an MTU, and disregards all subsequent MTU requests. Check out MTU is set to 517 for the first GATT client requesting an MTU for more information.

When performing a write request operation (write without response), the data sent is truncated to the MTU size. This function may be used to request a larger MTU size to be able to send more data at once.

A BluetoothGattCallback#onMtuChanged callback will indicate whether this operation was successful.

Java documentation for android.bluetooth.BluetoothGatt.requestMtu(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to