Before I would have a Session fbSession;
object that I would get when logging in using the FacebookFragment.
And at log out from my app, in order to clean my session, I would do this.
if (PSSocialService.getInstance().fbSession != null) {
PSSocialService.getInstance().fbSession.closeAndClearTokenInformation();
}
But now, there is no Session anymore. And the Login just gives me the LoginResult. So I am trying to understand, if I want to logout of my app, how can I set that?
This is my current implementation of logging in, if it helps:
fbButton.registerCallback(psSignInFlowActivity.mCallbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
loginResult.getAccessToken();
loader.setVisibility(View.VISIBLE);
if (PSApplicationClass.getInstance().pref.getUserId(getActivity()) == null)
PSUser.authenticate(getActivity(), Constants.FB, loginResult.getAccessToken().getToken(), null, loader, backFromAuth);
}
@Override
public void onCancel() {
loader.setVisibility(View.GONE);
}
@Override
public void onError(FacebookException e) {
// Handle exception
}
});
With the new SDK found out that this is way more easier than expected. You can simply logout of your FB session like this:
LoginManager.getInstance().logOut();