Но с тех пор я наблюдаю приток сбоев от пользователей Android 14 в этом блоке в onStartCommand
Код: Выделить всё
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;
Код: Выделить всё
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)
Подробнее здесь: https://stackoverflow.com/questions/776 ... foreground