我在这一行面临以下错误.setService(LocationFirebaseJobService::class.java)
::
类型推断失败。预期的类型不匹配:推断的类型是Class<LocationFirebaseJobService>
但Class<out JobService!>
预期的
这是我的代码:
val dispatcher = FirebaseJobDispatcher(GooglePlayDriver(context))
val myJob = dispatcher.newJobBuilder()
.setService(LocationFirebaseJobService::class.java)
.setTag("my-unique-tag")
.build()
我的 LocationFirebaseJobService 类:
class LocationFirebaseJobService: JobService() {
override fun onStartJob(p0: JobParameters?): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun onStopJob(p0: JobParameters?): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}