-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
你好,部分手机上会遇到这种错误 Unable to stop service com.shihoo.daemon.PlayMusicService@292e357: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=包名/com.shihoo.daemon.PlayMusicService }: app is in background uid UidRecord #13
Comments
高版本的开启服务需要用startForegroundService(Intent service) |
你好,targetSdkVersion 是28 |
启动服务的时候为何不加一个版本判断呢? |
是的,需要判断Android O版本,给一个前台通知。 |
if (Build.VERSION.SDK_INT >= 26) { |
你好,那我贴一下代码,供你参考:
} |
萬分感謝,我是通过gradle引入的,startForegroundNotification()和deleteForegroundNotification()这两个方法只用在我继承AbsWorkService的Service类中实现吧?引入的框架里的服务里面不用加吧? |
需要加的。 本工程代码不多,你可以下载后以library的形式添加到你的工程中去,这样方便在某些部分调整下,适配自己的业务逻辑 |
好的,谢谢 |
Unable to stop service com.shihoo.daemon.PlayMusicService@292e357: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=包名/com.shihoo.daemon.PlayMusicService }: app is in background uid UidRecord
The text was updated successfully, but these errors were encountered: