I am having problems implementing Device Firmware Update in Android. The specs of my development environment is:
- Samsung Galaxy S7 Edge.
- Nordic DFU API v1.5.1
- Nordic SDK 12.0 on Peripheral.
I don't have any problem starting the DFU process using DFUServiceInitiator object. The code for that is:
final DfuServiceInitiator starter = new DfuServiceInitiator(mDevice.getAddress()).setDeviceName(mDevice.getName()).setKeepBond(true);
// In order to show the notifications in Android Oreo. This line needs to be added.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
DfuServiceInitiator.createDfuNotificationChannel(mContext);
}
starter.setUnsafeExperimentalButtonlessServiceInSecureDfuEnabled(true);
starter.setZip(firmwarePath);
starter.start(mContext, BluetoothDfuService.class);
I am also registering/unregistering the DfuProgressListener properly in Activity Lifecycle hooks.
Now the problems i am facing are:
- During the DFU process, i am catching ErrorCode DfuBaseService.ERROR_INVALID_RESPONSE in my onError() method. The app is then disconnected from the device and the device broadcasts as DfuTarg.
- Sometimes during the DFU process, i am catching ErrorCode DfuBaseService.ERROR_DEVICE_DISCONNECTED in my onError() method. The app is disconnected but the device do not broadcast (not even in DfuTarg) for two minutes.
- Sometimes during the end of the DFU process, i am catching ErrorCode 3, which is apparently, GATT INSUF AUTHORIZATION error. The device do not broadcast (not even in DfuTarg) for two minutes.
This does not happen all the times. I would say, about 70% of the time there is no problem in uploading the complete firmware. Can anyone please help?