我在Android O操作系统上使用Service类。
我计划在后台使用Service。
安卓系统文档声明
如果你的应用程序的API级别为26或更高,系统会对使用或创建后台服务施加限制,除非应用程序本身在前台。如果应用程序需要创建前台服务,该应用程序应该调用
startForegroundService()。
如果使用startForegroundService(), Service会抛出以下错误。
Context.startForegroundService() did not then call
Service.startForeground()
这有什么问题?