我正在尝试注册Firebase电话号码。在尝试在我的手机上注册时,firebase不会发送验证码。但是Firebase在其他设备上尝试时会发送验证码。
private PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallBack = new PhoneAuthProvider
.OnVerificationStateChangedCallbacks()
{
@Override
public void onCodeSent(String s, PhoneAuthProvider.ForceResendingToken forceResendingToken)
{
super.onCodeSent(s, forceResendingToken);
verificationId = s;
}
@Override
public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential)
{
String code = phoneAuthCredential.getSmsCode();
Toast.makeText(getApplicationContext(),"Verification code received", Toast.LENGTH_LONG).show();
}
@Override
public void onVerificationFailed(FirebaseException e)
{
Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
}
};
// this method does not respond
try
{
PhoneAuthProvider.getInstance().verifyPhoneNumber(number, 60, TimeUnit.SECONDS, TaskExecutors.MAIN_THREAD, mCallBack);
}
catch (Exception e)
{
e.printStackTrace();
Toasty.error(getApplicationContext(), "OnVerificationStateChangedCallbacks " + e.getMessage(), Toast.LENGTH_LONG).show();
}