开发者

Clear Facebook session

Here I am trying to clear the values even if the session is true. So I am thinking of clearing the session. Below is what I am trying.

public boolean isSession() {
 开发者_StackOverflow   sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    String access_token = sharedPrefs.getString("access_token", "x");
    Long expires = sharedPrefs.getLong("access_expires", -1);
    if (access_token != null && expires != -1) {
        facebook.setAccessToken(access_token);
        facebook.setAccessExpires(expires);
    }
    return facebook.isSessionValid();

How do I clear the session here so that it returns false when I check the following?

public void getID() {
    if (isSession()) {

    }
}


com.facebook.Session session = com.facebook.Session.getActiveSession();
        if(session != null) session.closeAndClearTokenInformation();

This work perfectly for me


facebook.setAccessExpires(-1);

facebook.setAccessToken(null);

And then call isSessionValid()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜