笔记

笔记
笔记


App持续在后台超过60秒,系统才认为程序进入后台

请教我在TestService2.kt
onCreate中使用
//解决Android.0 启动前台服务的问题
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val notification= Notification.Builder(applicationContext, "channel_id")
.build()
startForeground(1,notification)// id为1时会报错误android.app.RemoteServiceException: Bad notification for startForeground
id为1时会报错误android.app.RemoteServiceException: Bad notification for
如果改为0时正常
