hat gerade eine meiner Android -Apps aktualisiert, um mit Ziel -SDK von 34 zu arbeiten. Meine App erfordert die Verwendung eines Vordergrunddienstes, das ist der Typ Special_use, da keiner der anderen Vordergrundtypen funktioniert. Der App Store hat es genehmigt, was schön ist. if (Build.VERSION.SDK_INT < 34) {
startForeground(NOTIFICATION_NUMBER++, getNotification(!enable_trace_mode, app_bundle));
} else {
startForeground(NOTIFICATION_NUMBER++, getNotification(!enable_trace_mode, app_bundle), ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE);
}
return START_STICKY;
< /code>
mit der folgenden Stapelverfolgung < /p>
Caused by android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.my.app/.NiceOverlayService
at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
at android.os.Parcel.readParcelableInternal(Parcel.java:4882)
at android.os.Parcel.readParcelable(Parcel.java:4864)
at android.os.Parcel.createExceptionOrNull(Parcel.java:3064)
at android.os.Parcel.createException(Parcel.java:3053)
at android.os.Parcel.readException(Parcel.java:3036)
at android.os.Parcel.readException(Parcel.java:2978)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7214)
at android.app.Service.startForeground(Service.java:862)
at com.my.app.NiceOverlayService.onStartCommand(NiceOverlayService.java:76)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5268)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2531)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8893)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
< /code>
Ich habe meinen Kopf geschlagen, um diesen Absturz zu reproduzieren, aber ohne Erfolg. Laut Protokollberichten erfolgt es in der ersten Sekunde, in der die App beginnt, was seltsam ist, da mein Dienst erst viel später beginnt, wenn der Benutzer dies zulässt. Ich denke, es könnte ein Gedächtnisproblem sein, aber ich bin mir dabei nicht zu 100% sicher. Ich habe gesehen, wie andere Leute hier ein ähnliches Problem erwähnt haben, aber keine todsichere Fix dafür. Kennt jemand eine Lösung dafür?
Android 14 ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed ⇐ Android
-
- Similar Topics
- Replies
- Views
- Last post