如何在不登录的情况下使用Firebase OTP验证来验证多个电话号码?

时间:2019-06-18 15:00:54

标签: java android firebase-authentication

我目前正在制作一个Android应用程序,必须使用进入场所的OTP验证每个人的电话号码。操作此操作的用户已在应用程序中签名,现在需要验证进入场所的每个人的电话号码。每次收到OTP时都无需签名怎么办?

我尝试使用常规的Firebase OTP验证,但是这使我的用户登录。我不希望这种情况发生。

这是我的mCallbacks函数

mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
                @Override
                public void onVerificationCompleted(PhoneAuthCredential credential) {
                    Toast.makeText(getApplicationContext(), "Verification Complete", Toast.LENGTH_SHORT).show();

                    showMessage("Success!!","OTP verified!" + credential);
                    cred = credential;
                    //btn_add_guest.setEnabled(true);

                }

                @Override
                public void onVerificationFailed(FirebaseException e) {
                    Toast.makeText(getApplicationContext(), "Verification Failed", Toast.LENGTH_SHORT).show();
                    Log.i(TAG,"Error is "+e.getMessage());
                }

                @Override
                public void onCodeSent(String verificationId,
                                       PhoneAuthProvider.ForceResendingToken token) {
                    Toast.makeText(getApplicationContext(), "Code Sent", Toast.LENGTH_SHORT).show();
                    mVerificationId = verificationId;
                    mResendToken = token;

                    Log.i(TAG,"VERFICATION ID IS"+mVerificationId);
                    Log.i(TAG,"RESEND TOKEN"+mResendToken);

                }
            };

0 个答案:

没有答案