Android-DFU-Library: DFU - DFU Service not found
Hi all, Before I tried to run my code, I tested DFU device services in nRF Connect app:
Device: Huawei P20, Samsuns S9 (Android 10s)
https://i.imgur.com/eoStwLQ.png
My code:
return DfuServiceInitiator(device.address)
.setDeviceName(device.name)
.setKeepBond(true)
.setNumberOfRetries(5)
.setZip(fileStreamUri, null)
Logcat:
Attempt: 1
Refreshing result: true
Cleaning up...
Restarting the service
Starting DFU service in foreground
Connecting to the device...
Connected to GATT server
Attempting to start service discovery... succeed
Action received: android.bluetooth.device.action.ACL_CONNECTED
I/DfuBaseService: Services discovered
**W/DfuBaseService: DFU Service not found.**
I/DfuBaseService: Disconnecting from the device...
I/DfuBaseService: Disconnected from GATT server
I/DfuBaseService: Refreshing result: true
I/DfuBaseService: Cleaning up...
I/DfuBaseService: Starting DFU service in foreground
I/DfuBaseService: Action received: android.bluetooth.device.action.ACL_DISCONNECTED
Do I have wrong configuration of DFUService initiator object?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (9 by maintainers)
Hi @archie94,
Observations
It’s a bit hard to say what is the root cause of this. Based on the logs I see that:
Conclusions
We did address similar issue with in #356 or #345. The issue is that on some Android devices switching to bootlaoder mode doesn’t trigger disconnection. The phone still thinks it’s connected. Some phones actually keep the connection active for some time. When the lib is searching for an incremented MAC it is still not ready. Then, after 2 seconds it tries to reconnect to the old MAC (which is still connected), so this succeeds, or at least the phone thinks so. Service discovery may fail, as the device has perhaps reset.
Those 2 PRs try to fix this issue by calling
disconnect()to make “sure” Android gets that, allowing setting “reset time” (delay before the lib starts scanning) or settings scan period (to increase from the default 2 seconds).Recommendation
I would recommend trying updating using the DFU app and trying different settings on the Settings screen. Check if you’re able to make it work on those phones before applying changes to your app. If that works, I recommend to migrate to the latest version or doing cherry-picking important commits (you need to search for them on your own).
Questions