无法转换为状态,错误“未解析的参考:状态”

时间:2019-06-02 23:36:17

标签: android kotlin sms-verification

我正在使用SMS检索器API,但正在获取未解决的参考:下一行的状态

val status = extras.get(SmsRetriever.EXTRA_STATUS) as Status

我的代码:

package com.tech.renters.myapplication

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.google.android.gms.auth.api.phone.SmsRetriever

class SmsReceiver : BroadcastReceiver(){
    private val codePattern = "(\\d{6})".toRegex()
    override fun onReceive(context: Context?, intent: Intent?) {
        if(SmsRetriever.SMS_RETRIEVED_ACTION == intent?.action){
            val extras  = intent.extras
            val status = extras.get(SmsRetriever.EXTRA_STATUS) as Status
        }
    }
}

0 个答案:

没有答案