onVerificationCompleted 不起作用和火力基地

时间:2021-07-03 21:03:32

标签: android firebase-authentication

通过firebase和android studio中的手机号码进行身份验证 未执行onVerificationCompleted方法,无法获取验证码:

PhoneAuthProvider.OnVerificationStateChangedCallbacks callbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
    @Override
    public void onVerificationCompleted(@NonNull PhoneAuthCredential phoneAuthCredential) 
    {//does not run on method calls

        String credential = phoneAuthCredential.getSmsCode();
        if(credential !=null){
            verification.setText(credential);
            sigIn(credential);
        }
        else{
            Toast.makeText(VerificationActivity.this,"Rechazado",Toast.LENGTH_SHORT).show();
        }
    }

    @Override
    public void onVerificationFailed(@NonNull FirebaseException e) {
        Toast.makeText(VerificationActivity.this,"fallida",Toast.LENGTH_LONG).show();
    }

    @Override
    public void onCodeSent(@NonNull String s, @NonNull 
            PhoneAuthProvider.ForceResendingToken forceResendingToken) {
        super.onCodeSent(s, forceResendingToken);
        Toast.makeText(VerificationActivity.this,"codigo enviado",Toast.LENGTH_LONG).show();
        Id = s;
    }
};
<块引用>

你能告诉我可能会发生什么吗?和一个解决方案,请和 提前谢谢你

0 个答案:

没有答案