当前位置:   article > 正文

startForground Bad notification for startForeground

bad notification for startforeground
	在Android 8.0系统以后开启服务的时候用的是使用startForegroundService方法去启动一个前台服务,但是如果启动服务后不做任何操作会出现ANR异常。为了避免出现ANR异常需要使用startforground。
	startforground的使用在onCreate中或者是onStartCommand中,但是有时候使用了该方法缺会出现  Bad notification for startForeground问题。
	出现这个问题的原因第一:看看AndroidManifest.xml中是不是缺少以下权限
	![在这里插入图片描述](https://img-blog.csdnimg.cn/aea66d0c13b942c59f6d80c2c4c890d3.png)
  • 1
  • 2
  • 3
  • 4

第二:看看AndroidManifest中application标签中是不是缺少
在这里插入图片描述

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号