简体   繁体   中英

Fabric digit getting crash in callback after verification

I have added Fabric Digit kit for verifying mobile number. Mobile number is getting verified successfully, but when I click verify button app gets crashed and when I reopen the app, digit session is created successfully, I have used Digit in many apps but not getting what is the issue.May be particular version or else?

Crash Log:

 #0. Crashed: IntentService[ATTRIBUTABLE_INVITE_DOWNLOAD_WORKER]: 0 0 0x0000000000000000 at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:772) at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:800) at com.digits.sdk.android.DigitsApiClientManager.getUserAuthClient(DigitsApiClientManager.java:53) at com.digits.sdk.android.AttributableInviteDownloadService.onHandleIntent(AttributableInviteDownloadService.java:55) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.os.HandlerThread.run(HandlerThread.java:61) -- Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:772) at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:800) at com.digits.sdk.android.DigitsApiClientManager.getUserAuthClient(DigitsApiClientManager.java:53) at com.digits.sdk.android.AttributableInviteDownloadService.onHandleIntent(AttributableInviteDownloadService.java:55) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.os.HandlerThread.run(HandlerThread.java:61) 

More detailed log is added here from Crashalytics

Code implemented in the app:

onCreate

 authCallback = new AuthCallback() { @Override public void success(DigitsSession session, String phoneNumber) { Log.d("msg", "session : " + session.toString() + " " + phoneNumber); MOBILE_NO = phoneNumber; storeUserData.setString(Constants.USER_MOBILE, phoneNumber); Digits.clearActiveSession(); startActivity(new Intent(activity, RegisterActivity.class) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } @Override public void failure(DigitsException error) { error.printStackTrace(); } }; 

for Verification

 binding.authButton.setCallback(authCallback); binding.authButton.setAuthTheme(R.style.CustomDigitsTheme); AuthConfig.Builder authConfigBuilder = new AuthConfig.Builder() .withAuthCallBack(authCallback) .withPhoneNumber("+91"); Digits.authenticate(authConfigBuilder.build()); 

You can try below code,

DigitsAuthButton digitsButton;
AuthCallback authcallback;
 digitsButton = (DigitsAuthButton) view.findViewById(R.id.auth_button);
        digitsButton.setAuthTheme(R.style.CustomDigitsTheme);
        authcallback = new AuthCallback() {
            @Override
            public void success(DigitsSession session, String phoneNumber) {
                edtMobNumber.setText(phoneNumber);
            }

            @Override
            public void failure(DigitsException exception) {

                exception.printStackTrace();

            }
        };
        digitsButton.setCallback(authcallback);
//launching digits activity on click of edit text
edtMobNumber.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        Digits.clearActiveSession();
        digitsButton.performClick();
    }
});

Let me know if it works for you.

I had the same issue and found that I was clearing the active session (logging out) inside callback methods.

Remove this line:

Digits.clearActiveSession();

Or in my case I removed this line:

Digits.logout();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM