'Android CallbackManager call back stopped working after upgrading to Facebook SDK 12.0.0 (Or 13)

I have an Android app that does login via Facebook. Everything was working when I was on Facebook SDK

implementation 'com.facebook.android:facebook-android-sdk:11.1.1'

However, recently I noticed in my Gradle file that there is an update available for Facebook SDK, so I updated it to

implementation 'com.facebook.android:facebook-android-sdk:13.0.0'

And then the problem happens.

Before I have my code setup like the following:

private void facebookSignInSetup() {
    //Facebook login setup
    callbackManager = CallbackManager.Factory.create();
    LoginManager.getInstance().registerCallback(callbackManager,
            new FacebookCallback<LoginResult>() {
                @Override
                public void onSuccess(LoginResult loginResult) {
                  ....
                }

And in my Activity class I have the following code:

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        callbackManager.onActivityResult(requestCode, resultCode, data);
        super.onActivityResult(requestCode, resultCode, data);
        ......
    }

When I was on Facebook SDK 11.1.1, after user login via Facebook, method: onActivityResult is fired then FacebookCallback registered is fired.

After upgrading to Facebook SDK 13.0.0 (I tried 12.0.0 also having the same problem), after the user login to Facebook, onActivityResult is called, however, FacebookCallback is not called.

Hence my login process is broken.

Anyone has the same problem and is the resolution?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source