I am using fb SDK v2.2 for android and I followed the tutorial so I am not going to repeat the code here. I am using the loginbutton of Android sdk and I set the uiHelper to have a callback on session start like this
uiHelper = new UiLifecycleHelper(this, new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
onSessionStateChange(session, state, exception);
}
});
when the user logs in by clicking on the fb login button then the onSessionStateChange is called (expected) and I call a certain code initialize user info.
Now if the user kills the app. Then opens the app again, it starts with the fact that the user logged in( Great). The problem happens that the onSessionStateChange is called again and then I end up "doing another heavy work" based on the fact that the session state is opened (as if the user is logging in again). I don't want this behavior. I just want to do this heavy work when the user clicks on log in and actually go through the login scenario not every time he opens the app and he is already logged in.
Any idea how to achieve that? Basically not to get the sessionStateChange called OR somehow differentiate between the case when he clicks on login and when he is actually logged in. Iam sure the sdk has it but I can't seem to find it
Thank you