我正在开发一个Android应用程序,我只想在不创建用户帐户的情况下验证手机号码.可能吗?我使用以下代码
private void startPhoneNumberVerification(String phoneNumber) {
PhoneAuthProvider.getInstance().verifyPhoneNumber(
phoneNumber,// Phone number to verify
60,// Timeout duration
TimeUnit.SECONDS,// Unit of timeout
this,// Activity (for callback binding)
mCallbacks); // OnVerificationStateChangedCallbacks
}
private void verifyPhoneNumberWithCode(String verificationId,String code) {
PhoneAuthCredential credential = PhoneAuthProvider.getCredential(verificationId,code);
signInWithPhoneAuthCredential(credential); // this function is creating user account,if not present. But We Don't want this
}
如果用户帐户不存在,以下功能将创建用户帐户,但我不想创建帐户,我只想验证用户输入的代码.有没有可用的回叫方法?
private void signInWithPhoneAuthCredential(final PhoneAuthCredential credential) {
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this,new OnCompleteListenerFailed ",Toast.LENGTH_SHORT).show();
verifyPhoneNumberWithCode(mVerificationId,editText.getText().toString().trim());
}
}
});
}
最佳答案