I'm getting this exception when scheduling a work manager task.
android.app.InvalidForegroundServiceTypeException: Starting FGS with type none callerApp=ProcessRecord{c23a512 15473:mypackage/u0a350} targetSDK=34 has been prohibited
I added
<service
android:name="androidx.work.impl.foreground.SystemForegroundService"
android:foregroundServiceType="dataSync"
android:exported="false"
android:stopWithTask="false"
tools:node="merge"/>
And the issue is still happening.
I then updated from work manager from 2.7.0 to 2.9.0 and still didn't help.
I'm at a bit of a loss as to what the issue could be. The exception is happening at at androidx.work.impl.foreground.SystemForegroundService$Api31Impl.startForeground(SystemForegroundService.java:193)
I've also checked and the merged manifest does have my stuff.
Does anyone know what the issue could be?
I must have missed a step. I had to add
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNCto theForegroundInfoconstructor.