Caused by java.lang.IllegalStateException Not allowed to start service Intent { cmp=com.x.x.x/.x.x.xService }: app is in background uid UidRecord(一)
解决方法:
1. 修改启动方式
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    context.startForegroundService(intent);
} else {
    context.startService(intent);
}
2. 并且在service里再调用startForeground方法,不然就会出现ANR
context.startForeground(SERVICE_ID, builder.getNotification());
app is in background uid UidRecord问题原因分析
https://www.cnblogs.com/mingfeng002/p/10725364.html
Caused by java.lang.IllegalStateException Not allowed to start service Intent { cmp=com.x.x.x/.x.x.xService }: app is in background uid UidRecord(一)的更多相关文章
- Caused by java.lang.IllegalStateException Not allowed to start service Intent { cmp=com.x.x.x/.x.x.xService }: app is in background uid UidRecord问题原因分析(二)
		应用在适配Android 8.0以上系统时,会发现后台启动不了服务,会报出如下异常,并强退: Fatal Exception: java.lang.IllegalStateException Not ... 
- java.lang.IllegalStateException: Not allowed to create transaction on shared EntityManager - use Spring transactions or EJB CMT instead
		java.lang.IllegalStateException: Not allowed to create transaction on sharedEntityManager - use Spri ... 
- Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError
		SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackO ... 
- 【spring boot】【elasticsearch】spring boot整合elasticsearch,启动报错Caused by: java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8
		spring boot整合elasticsearch, 启动报错: Caused by: java.lang.IllegalStateException: availableProcessors ], ... 
- Caused by: java.lang.IllegalStateException: Method has too many Body parameters
		feign多参数问题1.1GET方式错误写法 @RequestMapping(value="/test", method=RequestMethod.GET) Model test ... 
- Caused by:java.lang.IllegalStateException at android.media.MediaPlayer._setDataSource(Native Method)
		使用Mediaplayer播放本地音频,在第二次调用mediaplayer.setDataSource()时报错如下: Caused by: java.lang.IllegalStateExcepti ... 
- Caused by: java.lang.IllegalStateException: Expected raw type form of org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$Match
		spring 4.0.2,mybatis 3.2.6,aspectjweaver 1.8.10 使用的时候,报错: Caused by: java.lang.IllegalStateException ... 
- Caused by: java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available
		java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.co ... 
- Caused by: java.lang.IllegalStateException: duplicate key: datasource
		java.lang.IllegalStateException: Failed to load property source from location 'classpath:/applicatio ... 
随机推荐
- Python基础入门-While循环
			讲完了for循环我们继续来看第二个循环,那就是while循环,while循环和for循环虽然都是循环,但是有着本质的不同.我们先来看下她们之间的区别和联系: While循环和for循环区别: 1.fo ... 
- location.replace() keeps the history under control
			from https://dev.opera.com/articles/efficient-javascript Occasionally, it is necessary to change the ... 
- 基于IKAnalyzer搭建分词服务
			背景 前端高亮需要分词服务,nlp团队提供的分词服务需要跨域调用,而且后台数据索引使用的IK分词.综合评价,前端分词也需要基于IK分词器. IKAnalyzer服务已经停止更新,且对Lucene支持仅 ... 
- (转)Asp.Net生命周期系列一
			原文地址:http://www.cnblogs.com/skm-blog/archive/2013/07/07/3176713.html Asp.Net生命周期对于初级甚至中级程序员来说,一直都是一个 ... 
- Jquery  hover 事件
			hover(over,out)一个模仿悬停事件(鼠标移动到一个对象上面及移出这个对象)的方法.这是一个自定义的方法,它为频繁使用的任务提供了一种“保持在其中”的状态. 当鼠标移动到一个匹配的元素上面时 ... 
- 《Andorid开源》greenDao 数据库orm框架
			一 前言:以前没用框架写Andorid的Sqlite的时候就是用SQLiteDatabase ,SQLiteOpenHelper ,SQL语句等一些东西,特别在写SQL语句来进行 数据库操作的时 ... 
- C#多线程编程实战1.2暂停线程(休眠)
			using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ... 
- go channel缓冲区的大小
			go channel缓冲区的大小 len也可以作用于channel,代表现在channel缓冲区中还有多少数据没有读取.示例如下 c:=make(chan int,20) fmt.Println(&q ... 
- shell和matlab之间的参数传递
			shell和matlab之间的参数传递比shell和Python之间的参数传递要简单,在matlab程序中(以.m脚本文件为例,其他程序如函数等未测试)不需要进行任何配置,直接使用即可,见下面 ... 
- Win7下C/C++跨平台开发工具IDE的安装之CodeBlocks
			1. Win7下安装CodeBlocks: 下载带有mingw的CodeBlocks:http://www.codeblocks.org/downloads/26#windows 运行所下载程序: 点 ... 
