app is in background uid UidRecord错误

04-28 08:42:06.576  5425  5425 D AndroidRuntime: Shutting down VM
04-28 08:42:06.578  5425  5425 E AndroidRuntime: FATAL EXCEPTION: main
04-28 08:42:06.578  5425  5425 E AndroidRuntime: Process: jp.co.elmo.elmonote, PID: 5425
04-28 08:42:06.578  5425  5425 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver crc6421942cef9f1dae2f.BootReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=jp.co.elmo.elmonote/crc6414dfc74a030b5a5a.MyAccessibilityService }: app is in background uid UidRecord{f846716 u0a41 RCVR idle change:uncached procs:1 seq(0,0,0)}
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at android.app.ActivityThread.handleReceiver(ActivityThread.java:3388)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at android.app.ActivityThread.access$1200(ActivityThread.java:199)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:193)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6669)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=jp.co.elmo.elmonote/crc6414dfc74a030b5a5a.MyAccessibilityService }: app is in background uid UidRecord{f846716 u0a41 RCVR idle change:uncached procs:1 seq(0,0,0)}
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1577)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at android.app.ContextImpl.startService(ContextImpl.java:1532)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at android.content.ContextWrapper.startService(ContextWrapper.java:664)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at android.content.ContextWrapper.startService(ContextWrapper.java:664)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at crc6421942cef9f1dae2f.BootReceiver.n_onReceive(Native Method)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at crc6421942cef9f1dae2f.BootReceiver.onReceive(Unknown Source:0)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	at android.app.ActivityThread.handleReceiver(ActivityThread.java:3379)
04-28 08:42:06.578  5425  5425 E AndroidRuntime: 	... 8 more

Android 8.0 不再允许后台进程直接通过startService方式去启动服务,改为startForegroundService方式启动

参考博客:
https://stackoverflow.com/questions/64534317/android-11-java-lang-illegalstateexception-not-allowed-to-start-service-intent

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值