This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DFU App Crash - Bad notification for startForeground

So I came across an issue while working on developing an app that can update firmware OTA. I was using Nordic Semi - android DFU Library 

implementation 'no.nordicsemi.android:dfu:1.11.0'

But everytime I ran the app, we are able to select the file for update as well as the device but when we click the upload button - the app crashes with the following error.
I am attaching the log below, if anyone can kindly let me know where I am going wrong that would be amazing!

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ANDROID APP LOG


2021-10-26 15:09:08.936 26024-26024/com.solshare.solapp.ble_nordic_poc I/DfuBaseService: DFU service created. Version: 1.10.3
2021-10-26 15:09:08.952 26024-28910/com.solshare.solapp.ble_nordic_poc I/DfuBaseService: Starting DFU service in foreground
2021-10-26 15:09:08.962 26024-26024/com.solshare.solapp.ble_nordic_poc I/DfuBaseService: DFU service destroyed
2021-10-26 15:09:08.962 26024-26024/com.solshare.solapp.ble_nordic_poc D/AndroidRuntime: Shutting down VM
--------- beginning of crash
2021-10-26 15:09:08.963 26024-26024/com.solshare.solapp.ble_nordic_poc E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.solshare.solapp.ble_nordic_poc, PID: 26024
android.app.RemoteServiceException: Bad notification for startForeground
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2185)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:233)
at android.app.ActivityThread.main(ActivityThread.java:8010)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
2021-10-26 15:09:08.991 26024-28910/com.solshare.solapp.ble_nordic_poc I/DfuBaseService: Connecting to the device...
2021-10-26 15:09:08.992 26024-28910/com.solshare.solapp.ble_nordic_poc D/BluetoothGatt: connect() - device: CE:43:20:CE:AA:CC, auto: false
2021-10-26 15:09:08.992 26024-28910/com.solshare.solapp.ble_nordic_poc D/BluetoothGatt: registerApp()
2021-10-26 15:09:08.992 26024-28910/com.solshare.solapp.ble_nordic_poc D/BluetoothGatt: registerApp() - UUID=e6b8d3f2-ab91-4f1e-a31a-5cde3bbb8863
2021-10-26 15:09:08.994 26024-28857/com.solshare.solapp.ble_nordic_poc D/BluetoothGatt: onClientRegistered() - status=0 clientIf=7
2021-10-26 15:09:09.644 26024-28857/com.solshare.solapp.ble_nordic_poc D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=7 device=CE:43:20:CE:AA:CC
2021-10-26 15:09:09.644 26024-28857/com.solshare.solapp.ble_nordic_poc I/DfuBaseService: Connected to GATT server
2021-10-26 15:09:09.646 26024-28857/com.solshare.solapp.ble_nordic_poc D/BluetoothGatt: discoverServices() - device: CE:43:20:CE:AA:CC
2021-10-26 15:09:09.647 26024-28857/com.solshare.solapp.ble_nordic_poc I/DfuBaseService: Attempting to start service discovery... succeed
2021-10-26 15:09:10.086 26024-28857/com.solshare.solapp.ble_nordic_poc D/BluetoothGatt: onConnectionUpdated() - Device=CE:43:20:CE:AA:CC interval=6 latency=0 timeout=500 status=0
2021-10-26 15:09:10.292 26024-28857/com.solshare.solapp.ble_nordic_poc D/BluetoothGatt: onSearchComplete() = Device=CE:43:20:CE:AA:CC Status=0
2021-10-26 15:09:10.292 26024-28857/com.solshare.solapp.ble_nordic_poc I/DfuBaseService: Services discovered
2021-10-26 15:09:10.295 26024-28910/com.solshare.solapp.ble_nordic_poc I/DfuImpl: Buttonless service without bond sharing found -> SDK 13 or newer
2021-10-26 15:09:10.356 26024-28857/com.solshare.solapp.ble_nordic_poc D/BluetoothGatt: onConnectionUpdated() - Device=CE:43:20:CE:AA:CC interval=36 latency=0 timeout=500 status=0
2021-10-26 15:09:11.304 26024-28910/com.solshare.solapp.ble_nordic_poc I/DfuImpl: Enabling indications...
2021-10-26 15:09:11.304 26024-28910/com.solshare.solapp.ble_nordic_poc D/BluetoothGatt: setCharacteristicNotification() - uuid: 8ec90003-f315-4f60-9fb8-838830daea50 enable: true
2021-10-26 15:09:12.441 26024-28910/com.solshare.solapp.ble_nordic_poc I/DfuImpl: Sending Enter Bootloader (Op Code = 1)
2021-10-26 15:09:12.563 26024-28910/com.solshare.solapp.ble_nordic_poc I/DfuImpl: Response received (Op Code = 1, Status = 1)

Related