我已将firebase电话身份验证添加到我的 android 项目中。首先一切顺利。一段时间后,短信代码onVerificationCompleted()为空。谢谢!!
PhoneAuthProvider.getInstance().verifyPhoneNumber(mobileNumber, 60, TimeUnit.SECONDS, FirebasePhoneAuthActivity.this, new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
smsCode = phoneAuthCredential.getSmsCode();
Log.i(TAG, "onVerificationCompleted: CODE " + smsCode);
Log.i(TAG, "onVerificationCompleted: PROVIDER " + phoneAuthCredential.getProvider());
}
@Override
public void onVerificationFailed(FirebaseException e) {
e.printStackTrace();
}
@Override
public void onCodeSent(String s, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
Log.i(TAG, "onCodeSent: CODE " + s);
}
@Override
public void onCodeAutoRetrievalTimeOut(String s) {
super.onCodeAutoRetrievalTimeOut(s);
Log.i(TAG, "onCodeAutoRetrievalTimeOut: " + s);
}
});
Run Code Online (Sandbox Code Playgroud)