问题描述
在成功方法中,我一直在尝试使用phoneNumber,但是即使在我的android应用上成功进行了OTP检查之后,它也是一个空对象.请让我知道结构验证后如何获取电话号码,以将其用于我的应用程序中的用户注册.
In the success method, I've been trying to use the phoneNumber but it's a null object even after successful OTP check on my android app. Please let me know how can I get the phoneNumber after fabric verification to use it for user registration on my app.
digitsButton = (DigitsAuthButton) findViewById(R.id.auth_button);
digitsButton.setCallback(new AuthCallback() {
@Override
public void success(DigitsSession session,
String phoneNumber) {
// Do something with the session
Toast.makeText(WelcomeActivity.this,"Registration Successful",Toast.LENGTH_SHORT).show();
}
@Override
public void failure(DigitsException exception) {
// Do something on failure
Toast.makeText(WelcomeActivity.this,"Registration Failed",Toast.LENGTH_SHORT).show();
}
});
推荐答案
我不确定这是否是错误,但是如果已经有活动的会话,则不会返回该数字.无论如何,如果要进行身份验证,则可能检测到丢失的现有会话.如果您想强制显示此号码,请致电
I'm not sure if it's a bug, but if there's already an active session the number will not be returned.If you're authenticating anyway, you've probably detected a missing existing session. If you'd like to force this number to show up - call
Digits.getSessionManager().clearActiveSession();
设置回调之前.
这篇关于在Android应用上进行OTP验证后,Fabric digits返回null的phoneNumber对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!