android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground()
新的 Context.startForegroundService() 函数将启动一个前台服务。现在,即使应用在后台运行,系统也允许其调用 Context.startForegroundService()。不过,应用必须在创建服务后的五秒内调用该服务的
startForeground()
函数,而且还有创建通知栏。
05-08 21:52:25.685 2055 2117 I zygote64: libdebuggerd_client: done dumping process 3336 05-08 21:52:25.688 2055 2117 E ActivityManager: ANR in xxx 05-08 21:52:25.688 2055 2117 E ActivityManager: PID: 3589 05-08 21:52:25.688 2055 2117 E ActivityManager: Reason: Context.startForegroundService() did not then call Service.startForeground()
揣摩谷歌意图,一直在主推JobService,所以android8.0后最好还是用JobService,记得JobService继承的是Service哦,要新开线程执行耗时操作