Android Ble MTU size
As M. Kotzjan indicated, this is related to the MTU supported by the other device. From the Bluetooth Specification v5.2, Vol 3, Part G, Section 4.3.1 (Exchange MTU):-
This sub-procedure is used by the client to set the ATT_MTU to the
maximum possible value that can be supported by both devices when the
client supports a value greater than the default ATT_MTU for the
Attribute protocol. This sub- procedure shall only be initiated once
during a connection.
In other words, if you request an MTU of 512 and the remote device replies with 23 (the minimum MTU value), the connection's MTU will be 23. If you request 512 and the remote device replies with 100, the connection's MTU will be 100. If you request 200 and the remote device replies with 512, the connection's MTU will be 200.
Have a look at the following link for more information:-
- Maximising BLE Throughput Using Larger MTU
- The Ultimate Guide to Android BLE
Android BLE MTU size, has anyone sniffed it?
I couldnt get the MTU exchange packet while sniffing. But i have found in code :
#define GATT_MAX_MTU_SIZE 517
https://github.com/tieto/external-bluetooth-bluedroid/blob/master/stack/include/gatt_api.h
Change the MTU or Packet Size for Bluetooth in Android?
Yes, You are right - it is not possible in Android API. You can only get MTU value for an interface with networkInterface.getMTU() method.
Based on sources for the NetworkInterface class
public int getMTU() throws SocketException {
return readIntFile("/sys/class/net/" + name + "/mtu");
}
You probably can change MTU value (for rooted devices) - You need to write new int MTU value to "/sys/class/net/" + networkInterface.getName() + "/mtu" file.
But I'm not sure if it is reliable solution for You.
Related Topics
Remove Green Border Around Android Application
App Crashes (Sometimes) With Fatal Signal 11 (Sigsegv), Code 1
How to Avoid Keyboard Pushing Layout Up on Android React-Native
Making Voice Calls from Android Phone Connected to Linux
Android Scrollview Not Scrolling Down After Keyboard Opens
Java.Lang.Runtimeexception: Canvas: Trying to Draw Too Large(144000000Bytes) Bitmap
How to Remove Unnecessary Margins from Toolbar
How to Add a Newline to a Textview in Android
How to Set Value for Each Item Button Increase and Decrease Click and Set That Value in Text View
How to Check If a Value Exists Already in a Firebase Data Class Android
Android How to Get Current Positon on Recyclerview That User Scrolled to Item
How to Dismiss Notification After Action Has Been Clicked
Alarm Manager Won't Work When the App Is Killed in the Background and Device Is Locked
How to Connect SQL Server to Android Application
Showing Thumbnail for Link in Whatsapp || Og:Image Meta-Tag Doesn't Work