我不知道为什么onHandleWork内部的数据为null,这是我的努力:
class OfferJobIntentService :JobIntentService {
var oppoPayRepository:OppoPayRepository?=null
var preferenceProvider: PreferenceProvider?=null
constructor() // secondary constructor
constructor(oppoPayRepository:OppoPayRepository,preferenceProvider: PreferenceProvider):this(){ // secondary constructor
this.oppoPayRepository = oppoPayRepository
this.preferenceProvider=preferenceProvider
Log.e("msg1--","oppoPayRepository1"+oppoPayRepository+"----"+preferenceProvider)
}
override fun onHandleWork(intent: Intent) {
if(oppoPayRepository!=null){
Log.e("msg2--","oppoPayRepository2--"+oppoPayRepository)
}else{
Log.e("msg3--","null")
}
Logcat:
2019-10-27 00:50:06.629 20584-20584/com.oppopay.payments E/msg1--: oppoPayRepository1com.oppopay.payments.data.repository.OppoPayRepositoryImpl@b1e6ea3----com.oppopay.payments.data.provider.PreferenceProvider@6bcf5a0
2019-10-27 00:50:08.290 20584-20757/com.oppopay.payments E/LB: fail to open file: No such file or directory
2019-10-27 00:50:08.349 20584-20728/com.oppopay.payments E/msg3--: null