Cactus icon indicating copy to clipboard operation
Cactus copied to clipboard

服务问题

Open pz-bottle opened this issue 4 years ago • 9 comments

android.app.RemoteServiceException Context.startForegroundService() did not then call Service.startForeground() 大佬这个carsh问题太多了,可否针对性做一下优化?

pz-bottle avatar Feb 01 '21 06:02 pz-bottle

android10特别多,太难了

pz-bottle avatar Feb 03 '21 06:02 pz-bottle

显示通知栏,调用hideNotificationAfterO设置为false,然后卸载app重新安装

gyf-dev avatar Feb 03 '21 06:02 gyf-dev

hideNotificationAfterO这个属性框架不是默认为false的吗?

pz-bottle avatar Feb 03 '21 06:02 pz-bottle

那你通知栏有显示通知吗?

gyf-dev avatar Feb 03 '21 07:02 gyf-dev

刚刚看了代码原来hideNotificationAfterO这个属性默认为true,不过过我这边做了挂后台显示通知栏的功能,但是我没有使用service去显示通知栏

pz-bottle avatar Feb 03 '21 07:02 pz-bottle

Cactus.getInstance() .setBackgroundMusicEnabled(true) .register(this); 在项目里我一开始是这样使用的,没有加hideNotificationAfterO(false)这个

pz-bottle avatar Feb 03 '21 07:02 pz-bottle

就是隐藏8.0通知栏导致的,要显示出来

gyf-dev avatar Feb 03 '21 07:02 gyf-dev

嗯嗯,好吧,那我先试试

pz-bottle avatar Feb 03 '21 07:02 pz-bottle

不过我之前就是使用service发送一个Notification来保活的,发现一堆这样的carsh,所以我才找了大佬你的这个无声音乐框架,我也尝试了用JobIntentService去实现发现还是有这个carsh,这个问题是因为服务的启动和停止引起的我百度了好久,没有一个好的解决方法,都快绝望了。

pz-bottle avatar Feb 03 '21 07:02 pz-bottle