Facebook android sdk 4.0, way to cancel callback from LoginManager

I am using android sdk 4.0 inmy android app. I have an Activity whose functionality is to post some message to facebook (this is not my main activity of my application) I do the following to login to facebook and then post a message

FacebookSdk.sdkInitialize(this.getApplicationContext());
callbackManager = CallbackManager.Factory.create();
LoginManager.getInstance().registerCallback(callbackManager,  
    new FacebookCallback<LoginResult>() {
                @Override
                public void onSuccess(LoginResult loginResult) {
                    //Login is successfull, now post the message.
                }

    });

Questions: How do I cancel this callback from LoginManager? I did not find any method in LoginManager for this.

Any reason why sdk is designed in such a way that it does not provide the ability to unregister?

The problem is that if my activity is destroyed and recreated (say, due to the rotation of the device), LoginManager will always have a link to my previous instance of activity, which is not right.

onDestory .

,

+4
1

LoginManager , . 1-1 , .

+3

All Articles