Xamarin
Xamarin.Forms Android PhoneAuthProvider.Instance.VerifyPhoneNumber deprecated Resolve
NicSub
2021. 4. 8. 10:30
728x90
반응형
Xamarin.Forms Android PhoneAuthProvider.Instance.VerifyPhoneNumber deprecated
변경전
PhoneAuthProvider.Instance.VerifyPhoneNumber(
phoneNumber,
OTP_TIMEOUT, // const int 30
TimeUnit.Seconds,
Platform.CurrentActivity,
onVerificaton);
변경후
FirebaseAuth auth = FirebaseAuth.Instance;
PhoneAuthOptions options =
PhoneAuthOptions.NewBuilder(auth)
.SetPhoneNumber(phoneNumber) // Phone number to verify
.SetTimeout((Java.Lang.Long)30L, TimeUnit.Seconds) // Timeout and unit
.SetActivity(Platform.CurrentActivity) // Activity (for callback binding)
.SetCallbacks(this) // OnVerificationStateChangedCallbacks
.Build();
PhoneAuthProvider.VerifyPhoneNumber(options);
--> OnCodeSent 자동 실행.
public override void OnCodeSent(string verificationId, PhoneAuthProvider.ForceResendingToken forceResendingToken)
{
base.OnCodeSent(verificationId, forceResendingToken);
_verificationId = verificationId;
this._forceResendingToken = forceResendingToken;
_phoneAuthTcs?.TrySetResult(true);
Console.WriteLine("#######:"+forceResendingToken.ToString());
Console.WriteLine("#############:"+_phoneAuthTcs.ToString());
System.Diagnostics.Debug.WriteLine("################# PhoneAuthCredential created Automatically" + _verificationId.ToString());
}
반응형