I have a problem in Resend sms from my code, that code can't apply the Resend verify code from Firebase.
buttonResend = findViewById(R.id.buttonResend);
final String phonenumber = getIntent().getStringExtra("phonenumber");
sendVerificationCode(phonenumber);
this is buttonResend code
findViewById(R.id.buttonResend).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String code = editTextCode.getText().toString().trim();
resendVerificationCode(phonenumber, token);
}
});
}
the method is sending verification code
private void sendVerificationCode(String number) {
progressBar.setVisibility(View.VISIBLE);
PhoneAuthProvider.getInstance().verifyPhoneNumber(
number, // Phone number to verify
60, // Timeout duration
TimeUnit.SECONDS, // Unit of timeout
TaskExecutors.MAIN_THREAD, // Activity (for callback binding)
mCallbacks);
}
and this is for resendVertificationCode
private void resendVerificationCode(String number, PhoneAuthProvider.ForceResendingToken token) {
PhoneAuthProvider.getInstance().verifyPhoneNumber(
number, // Phone number to verify
60, // Timeout duration
TimeUnit.SECONDS, // Unit of timeout
this, // Activity (for callback binding)
mCallbacks, // OnVerificationStateChangedCallbacks
token); // ForceResendingToken from callbacks
}
}
Can you all fix the Resend code? Thanks.
Comments
Post a Comment