我在firebase中使用PhoneAuthProvider,当用户意外键入不在其设备中的其他电话号码时,我的用户会遇到问题。发生的事情是短信代码被发送到该电话号码但我无法检测到触发必要的操作。
@Override
public void onVerificationCompleted(PhoneAuthCredential credential) {
try {
Toast.makeText( RegistrationStepOne.this, "Phone number verified successfully!", Toast.LENGTH_SHORT ).show();
Intent step1=new Intent(RegistrationStepOne.this,RegistrationStepTwo.class);
Bundle extraMain = new Bundle();
extraMain.putString( "phoneNumber", getPhoneNo.getText().toString());
step1.putExtras( extraMain );
startActivity(step1);
RegistrationStepOne.this.finish();
} catch (NullPointerException b) {
b.printStackTrace();
passDialog.dismiss();
}
}
上述方法无法检测到,
以下的方法都不能检测到@Override
public void onVerificationFailed(FirebaseException e) {
Log.d( "FEL", e.getLocalizedMessage() );
verifyCode.setText( "Resend Request" );
if (e instanceof FirebaseAuthInvalidCredentialsException) {
} else if (e instanceof FirebaseTooManyRequestsException) {
Toast.makeText( RegistrationStepOne.this, "Too Many Requests Sent...Please try again later", Toast.LENGTH_SHORT ).show();
}
}
@Override
public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingToken token) {
Log.d( TAG, "onCodeSent:" + verificationId );
mVerificationId = verificationId;
mResendToken = token;
}
我应该在哪里以及如何检测到如果其他设备接收到代码则验证不成功