我正在使用以下代码从facebook登出..
public static void callFacebookLogout(Context context) {
Session session = Session.getActiveSession();
if (session != null) {
if (!session.isClosed()) {
//session.close();
session.closeAndClearTokenInformation();
}
} else {
session = new Session(context);
Session.setActiveSession(session);
//session.close();
session.closeAndClearTokenInformation();
}
}
在此之后,我无法在登录后获取用户详细信息,因为我将获得null GraphUser ..
mFacebookLogin.setUserInfoChangedCallback(new LoginButton.UserInfoChangedCallback() {
@Override
public void onUserInfoFetched(GraphUser user) {
if (user != null) {
getFacebookUserInformation();
}else {
//handle error case
}
}
});
我正在回复
private Session.StatusCallback callback = new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
Log.i("facebook", "isOpened: "+state.isOpened());
Log.i("facebook", "isClosed: "+state.isClosed());
}
};
状态为isClosed为真。
简而言之,流程就是这样......