After you have confirmed,

I have added a dialing kit to verify the mobile number. The mobile number is validated successfully, but when I press the confirm button, the app gets crashed, and when I open the app again, the digits session is created successfully, I have used Digit in many apps, but I don’t understand what the problem is. Maybe a specific version, otherwise

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)
      

Run codeHide result


Added more detailed log here from Crashalytics

The code implemented in the application:

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

Run codeHide result


for check

binding.authButton.setCallback(authCallback);
                            binding.authButton.setAuthTheme(R.style.CustomDigitsTheme);

                            AuthConfig.Builder authConfigBuilder = new AuthConfig.Builder()
                                    
                                    .withAuthCallBack(authCallback)
                                    .withPhoneNumber("+91");

                            Digits.authenticate(authConfigBuilder.build());
      

Run codeHide result


+3


source to share


2 answers


You can try following the code below,

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 this works for you.

+1


source


I had the same problem and found that I am clearing the active session (logout) inside the callback methods.

Remove this line:

Digits.clearActiveSession();

      



Or, in my case, I removed this line:

Digits.logout();

      

0


source







All Articles