fabric digits returns a null object of phoneNumber after OTP verification on android app

一个人想着一个人 提交于 2019-12-07 02:05:35

问题


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();
        }
    });

回答1:


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(); 

before setting callback.



来源:https://stackoverflow.com/questions/31679089/fabric-digits-returns-a-null-object-of-phonenumber-after-otp-verification-on-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!