java.lang.RuntimeException: Unable to start service me.him188.ani.app.domain.torrent.service.AniTorrentService@89fe49 with Intent { cmp=me.him188.ani/.app.domain.torrent.service.AniTorrentService (has extras) }: android.app.ForegroundServiceStartNotAllowedException: Time limit already exhausted for foreground service type dataSync
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5572)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2705)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:249)
at android.os.Looper.loop(Looper.java:337)
at android.app.ActivityThread.main(ActivityThread.java:9572)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
Caused by: android.app.ForegroundServiceStartNotAllowedException: Time limit already exhausted for foreground service type dataSync
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:5089)
at android.os.Parcel.readParcelable(Parcel.java:5071)
at android.os.Parcel.createExceptionOrNull(Parcel.java:3251)
at android.os.Parcel.createException(Parcel.java:3240)
at android.os.Parcel.readException(Parcel.java:3223)
at android.os.Parcel.readException(Parcel.java:3165)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7554)
at android.app.Service.startForeground(Service.java:776)
at me.him188.ani.app.domain.torrent.service.ServiceNotification.createNotification(Unknown Source:67)
at me.him188.ani.app.domain.torrent.service.AniTorrentService.onStartCommand(Unknown Source:89)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5554)
... 9 common frames omitted
问题描述
https://developer.android.com/about/versions/15/behavior-changes-15#datasync-timeout 需要 service 在后台运行快 6h 时自己结束,等用户下次开启 app
复现步骤
No response
Ani 版本号
4.0.0
操作系统
No response
应用日志