Closed pashaoleynik97 closed 7 months ago
Hello, The library does not define the service in the manifest. It was delegated to the apps using it. You may:
<service>
tag, specify the service type to connectedDevice
. Add FOREGROUND_SERVICE_CONNECTED_DEVICE
permission, this is also needed. Mind, that you'll have to provide a video when publishing the app to Google Play showing how that permission is used. Just a video of DFU should work (worked for us in nRF DFU).Thanks for the answer, @philips77
You are right, there were missing property in <service>
tag: android:foregroundServiceType="connectedDevice"
.
With such Manifest it works fine:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- ... -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />
<application>
<service
android:name="com.companyname.app.service.MyDfuService"
android:foregroundServiceType="connectedDevice"
android:enabled="true"
android:exported="false" />
</application>
</manifest>
Where do you suspect the issue?
Issue related to Android version or specific device
Version
2.4.0 (Latest)
Describe the issue
In the
DfuBaseService.java
there is a line to start Foreground Service:startForeground(NOTIFICATION_ID, builder.build());
The problem is that apps targeting Android 14 requires service type to be specified. So, when DFU library tries to go foreground, it crashes with exception:
android.app.MissingForegroundServiceTypeException: Starting FGS without a type
.Lib version:
no.nordicsemi.android:dfu:2.4.0
Relevant log output