NordicSemiconductor / Android-DFU-Library

Device Firmware Update library and Android app
http://www.nordicsemi.com/dfu
BSD 3-Clause "New" or "Revised" License
763 stars 269 forks source link

Android 14 GATT 133 1 #441

Open MarioTheGreatest opened 6 months ago

MarioTheGreatest commented 6 months ago

Where do you suspect the issue?

Issue related to Android version or specific device

Version

2.4.1 (Latest)

Describe the issue

image

On Android bellow 14 the DFU library uploads the firmware as expected, but on Android 14 for some reason it will make 3 attempts while stuck on onDeviceConnecting and then return GATT Error 133 1. I have tried disableMtuRequest() and setPacketsReceiptNotificationsValue(1) but it doesn't fix the issue.

Relevant log output

No response

sumitemizentech commented 6 months ago

I am having similar issue on android 14, Samsung phone. After 3% it throws an error - GATT INVALID PDU.

SEAbdulbasit commented 2 months ago

Same issue on the Samsung devices with OS version 14 Connection state change error: 133 newState: 0 An error occurred while connecting to the device: 133. Working fine with other Vendors.

SEAbdulbasit commented 2 months ago

When i pair first and then try to update the firmware then it works fine.

christian-zs commented 1 month ago

I have the same problem here. I need to apply for the dynamic permission ACCESS_FINE_LOCATION. After applying, it's done.

christian-zs commented 1 month ago

Where do you suspect the issue?

Issue related to Android version or specific device

Version

2.4.1 (Latest)

Describe the issue

image

On Android bellow 14 the DFU library uploads the firmware as expected, but on Android 14 for some reason it will make 3 attempts while stuck on onDeviceConnecting and then return GATT Error 133 1. I have tried disableMtuRequest() and setPacketsReceiptNotificationsValue(1) but it doesn't fix the issue.

Relevant log output

No response I have the same problem here. I need to apply for the dynamic permission ACCESS_FINE_LOCATION. After applying, it's done.

roland-ryan-rm commented 1 month ago

Seeing the same issue here, except my app has already been granted the ACCESS_FINE_LOCATION permission (and even ACCESS_BACKGROUND_LOCATION) and I'm still seeing the issue. Worth noting though is that I only see the issue when the screen is locked.

Update: I downloaded the source code for 1.12.0, which was the previous version my app was using before I updated my targetSdk to 34 and had to update this library. I made minimal modifications to the source code of 1.12.0 to target 34 and use ContextCompat to register recievers. Long story short, once I got it to compile and got the jar loaded into my app, this issue no longer occurs. So it's definitely a bug in the library itself, and definitely something that was implemented since 1.12.0.

philips77 commented 2 weeks ago

Hello, Last week we released version 2.6, which should fix scanning in background. Did you try it?

As it appears only in background, I suspect it's related to scanning without a ScanFilter (or actually, with an empty one). Recent Android versions began to check if the filter isn't empty. In that case the phone doesn't scan and in result cannot connect to the device advertising with address +1.

Since 2.6 the filters are no longer empty and you may customize them using: https://github.com/NordicSemiconductor/Android-DFU-Library/blob/4123bdd5f20c5f8a1a51cb61546b4fc132513dec/lib/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1987-L1990