i\'m new on android - facebook integration.
I\'m trying to integrate my app with facebook, so i follow all the steps on the facebook tutorial, and things work fine (at le
Facebook remove session in new SDK. check my answer for same question
there full integration code is given by me.
you can check whether user is logged in or not by this code.
profile = Profile.getCurrentProfile().getCurrentProfile();
if (profile != null) {
// user has logged in
} else {
// user has not logged in
}
After looking around, i realize that the Session class on the new facebook SDK is not used. Instead that i found something like this, it solved my question:
loginButton = (LoginButton)findViewById(R.id.login_button);
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
Log.e("Content", "User ID: " + loginResult.getAccessToken().getUserId() + "\n" + "Auth Token: " + loginResult.getAccessToken().getToken());
}
@Override
public void onCancel() {
//"If login attempt canceled.";
}
@Override
public void onError(FacebookException e) {
//"If login attempt Failed.";
}});