android.app.BackgroundServiceStartNotAllowedException

简介: android.app.BackgroundServiceStartNotAllowedException

android.app.BackgroundServiceStartNotAllowedException


--------- beginning of crash
05-09 01:25:24.465  2187  2187 E AndroidRuntime: FATAL EXCEPTION: main
05-09 01:25:24.465  2187  2187 E AndroidRuntime: Process: com.android.gallery3d, PID: 2187
05-09 01:25:24.465  2187  2187 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.android.gallery3d.app.PackagesMonitor: android.app.BackgroundServiceStartNotAllowedException: Not allowed to start service Intent { act=android.intent.action.PACKAGE_CHANGED dat=package:com.mycompany.anton_mokshyn.touchscreentest flg=0x5000010 cmp=com.android.gallery3d/.app.PackagesMonitor$AsyncService (has extras) }: app is in background uid UidRecord{2dc63ba u0a53 RCVR idle change:idle|uncached procs:0 seq(0,0,0)}
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at android.app.ActivityThread.handleReceiver(ActivityThread.java:4384)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at android.app.ActivityThread.access$1600(ActivityThread.java:256)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2102)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:106)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at android.os.Looper.loopOnce(Looper.java:201)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at android.os.Looper.loop(Looper.java:288)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:7870)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
05-09 01:25:24.465  2187  2187 E AndroidRuntime: Caused by: android.app.BackgroundServiceStartNotAllowedException: Not allowed to start service Intent { act=android.intent.action.PACKAGE_CHANGED dat=package:com.mycompany.anton_mokshyn.touchscreentest flg=0x5000010 cmp=com.android.gallery3d/.app.PackagesMonitor$AsyncService (has extras) }: app is in background uid UidRecord{2dc63ba u0a53 RCVR idle change:idle|uncached procs:0 seq(0,0,0)}
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1870)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at android.app.ContextImpl.startService(ContextImpl.java:1826)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at android.content.ContextWrapper.startService(ContextWrapper.java:776)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at android.content.ContextWrapper.startService(ContextWrapper.java:776)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at com.android.gallery3d.app.PackagesMonitor.onReceive(PackagesMonitor.java:40)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     at android.app.ActivityThread.handleReceiver(ActivityThread.java:4375)
05-09 01:25:24.465  2187  2187 E AndroidRuntime:     ... 9 more

 

BackgroundServiceStartNotAllowedException  |  Android Developers (google.cn)


解决方法:

Android O之后 要用startForegroundService 代替 startService

目录
相关文章
|
Android开发
Android can-utils
Android can-utils
235 0
错误: 程序包android.support.v7.app不存在 import android.support.v7.app.AppCompatActivity
错误: 程序包android.support.v7.app不存在 import android.support.v7.app.AppCompatActivity
428 0
程序包androidx.appcompat.app不存在
程序包androidx.appcompat.app不存在
375 0
android.support.v4.app.FragmentManager无法转换为android.app.FragmentManager
android.support.v4.app.FragmentManager无法转换为android.app.FragmentManager
144 0
android.support.v4.app.FragmentManager无法转换为android.app.FragmentManager
android.support.v4.app.Fragment$InstantiationException问题解决
android.support.v4.app.Fragment$InstantiationException问题解决
|
Java API Android开发
Android中Context的详细介绍
版权声明:本文为sydMobile原创文章,转载请务必注明出处! https://blog.csdn.net/sydMobile/article/details/78717605 文章最早发布于我的微信公众号 Android_De_Home 中,欢迎大家扫描下面二维码关注微信公众获取更多知识内容。
1185 0
|
Android开发 Java 存储
Android Context 干货
image.png 一、源码角度解析Context 从系统的角度来理解:Context是一个场景,代表与操作系统的交互的一种过程。Context是一个抽象类;Activity、Service、Application是它的子类; image.png 二、Context 应用场景 image.png 数字1:启动Activity在这些类中是可以的,但是需要创建一个新的task。
1083 0