ForegroundServiceStartNotAllowedException

Michael Wagner michael.wagner at gmx.at
Mon Sep 23 22:10:00 BST 2024


Hi,

I am using KDE Connect 1.32.2 (downloaded APK from F-Droid) on a Galaxy S22 with Android v14. Android complains that KDE Connect crashes repeatedly.

In logcat I found following Exceptions:

09-23 18:43:15.760 30945 30945 E AndroidRuntime: FATAL EXCEPTION: main
09-23 18:43:15.760 30945 30945 E AndroidRuntime: Process: org.kde.kdeconnect_tp, PID: 30945
09-23 18:43:15.760 30945 30945 E AndroidRuntime: java.lang.RuntimeException: Unable to start service org.kde.kdeconnect.BackgroundService at ddb2aad with null: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service org.kde.kdeconnect_tp/org.kde.kdeconnect.BackgroundService
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5286)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2531)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:230)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:319)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:8919)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: Caused by: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service org.kde.kdeconnect_tp/org.kde.kdeconnect.BackgroundService
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.os.Parcel.readParcelableInternal(Parcel.java:4882)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.os.Parcel.readParcelable(Parcel.java:4864)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.os.Parcel.createExceptionOrNull(Parcel.java:3064)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.os.Parcel.createException(Parcel.java:3053)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.os.Parcel.readException(Parcel.java:3036)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.os.Parcel.readException(Parcel.java:2978)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7234)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.app.Service.startForeground(Service.java:862)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at org.kde.kdeconnect.BackgroundService$$ExternalSyntheticApiModelOutline0.m(R8$$SyntheticClass:0)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at org.kde.kdeconnect.BackgroundService.onStartCommand(BackgroundService.java:276)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5268)
09-23 18:43:15.760 30945 30945 E AndroidRuntime: 	... 9 more
09-23 18:43:17.085 30977 30977 E AndroidRuntime: FATAL EXCEPTION: main
09-23 18:43:17.085 30977 30977 E AndroidRuntime: Process: org.kde.kdeconnect_tp, PID: 30977
09-23 18:43:17.085 30977 30977 E AndroidRuntime: java.lang.RuntimeException: Unable to start service org.kde.kdeconnect.BackgroundService at ddb2aad with null: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service org.kde.kdeconnect_tp/org.kde.kdeconnect.BackgroundService
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5286)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2531)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:230)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:319)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:8919)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: Caused by: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service org.kde.kdeconnect_tp/org.kde.kdeconnect.BackgroundService
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.os.Parcel.readParcelableInternal(Parcel.java:4882)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.os.Parcel.readParcelable(Parcel.java:4864)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.os.Parcel.createExceptionOrNull(Parcel.java:3064)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.os.Parcel.createException(Parcel.java:3053)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.os.Parcel.readException(Parcel.java:3036)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.os.Parcel.readException(Parcel.java:2978)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7234)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.app.Service.startForeground(Service.java:862)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at org.kde.kdeconnect.BackgroundService$$ExternalSyntheticApiModelOutline0.m(R8$$SyntheticClass:0)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at org.kde.kdeconnect.BackgroundService.onStartCommand(BackgroundService.java:276)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5268)
09-23 18:43:17.085 30977 30977 E AndroidRuntime: 	... 9 more

Is this a bug, or just a lack of permissions? Do I need to grant something manually?

Br,
Michael


More information about the KDEConnect mailing list