Open kurogalaxy opened 4 months ago
I've seen the same thing today when porting some code that was written against a much older version (7.4.1). However, when I stepped through the code in Android Studio I couldn't recreate it.
That's led me to add a 500ms sleep between the connect promise resolving and calling requestMTU which seems to be enough
I added some extra logging to try and find the issue and I'm reasonably sure that in Peripheral.java gatt.requestMtu()
is being called, but onMtuChanged
is not so this may be a behaviour change in Android (or maybe Samsung?) since my code was last used.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
On Android 14 (not sure about 13) I ran into this for any value smaller than 23
, but then I realized it's the standard BLE protocol that the MTU is 23 or higher, so maybe that explained it. I think react-native-ble-manager
should add a line in requestMTU
that ensures the value is higher or equal 23
requestMTU(peripheralId: string, mtu: number) {
mtu = Math.max(mtu, 23);
Describe the bug After connecting I call the requestMTU method and it never resolves so the app won't continue with the flow.
To Reproduce Steps to reproduce the behavior:
Expected behavior requestMTU should resolve with either an error or a number.
Screenshots If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
Additional context On my Android 13 phone it usually works but there are some times that it won't resolve either.