mCallbacks = new PhoneAuthProvIDer.OnVerificationStateChangedCallbacks() { @OverrIDe public voID onVerificationCompleted(PhoneAuthCredential credential) { Log.d(TAG,"onVerificationCompleted:" + credential); signInWithPhoneAuthCredential(credential); } @OverrIDe public voID onVerificationFailed(FirebaseException e) { Log.w(TAG,"onVerificationFailed",e); } @OverrIDe public voID onCodeSent(String verificationID,PhoneAuthProvIDer.ForceResendingToken token) { Log.d(TAG,"onCodeSent:" + verificationID); // Save verification ID and resending token so we can use them later mVerificationID = verificationID; mResendToken = token; }};
我的问题是关于onCodeSent方法.它在这里的文件上说(https://firebase.google.com/docs/reference/android/com/google/firebase/auth/PhoneAuthProvider.ForceResendingToken)
该令牌可用于强制重新发送SMS验证码.但是,在对doc进行一些研究后,我仍然不知道如何.
我想问一下如何使用此令牌重新发送短信验证?
解决方法 资料来源: Github这是用于重新发送SMS验证的方法.
private voID resendVerificationCode(String phoneNumber,PhoneAuthProvIDer.ForceResendingToken token) { PhoneAuthProvIDer.getInstance().verifyPhoneNumber( phoneNumber,// Phone number to verify 60,// Timeout duration TimeUnit.SECONDS,// Unit of timeout this,// Activity (for callback binding) mCallbacks,// OnVerificationStateChangedCallbacks token); // ForceResendingToken from callbacks}总结
以上是内存溢出为你收集整理的如何在Firebase Phone Authentication Android中重新发送短信验证?全部内容,希望文章能够帮你解决如何在Firebase Phone Authentication Android中重新发送短信验证?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)