Domanda

I have a problem, logging out from Facebook with the FacebookSDK (3.7). I already tried lots of possibilities but none seems to work, when I try with:

fb.logout(ScoreActivity.this);

or with

fb.logout(ScoreActivity.this.getApplicationContext());

or something similar, i get an IllegalArgumentException (but don't know why..) just a short explanation: "fb" is an object of the type Facebook, and "ScoreActivity" is the activity, where the logout should happen.. Just form Information: The Login is working..

the other method I tried is the following: I call the following function:

logoutfromfb(ScoreActivity.this.getApplicationContext());

which is defined like this:

public static void logoutfromfb(Context context) {
    Session session = Session.getActiveSession();
    if (session != null) {
        if (!session.isClosed()) {
            session.closeAndClearTokenInformation();
            //clear your preferences if saved
        }
    } else {
        session = new Session(context);
        Session.setActiveSession(session);
        session.closeAndClearTokenInformation();
            //clear your preferences if saved
    }
}

should actually work and I dont even get an error, looking in my LogCat but it's not working, I can press the button how often I want, but nothing happens.... I really hope somebody can help me...

If you need more Infos, just let me know.

Nessuna soluzione corretta

Altri suggerimenti

I have the same problem it seems that the logout works but since you have the official facebook application still logged in it will authenticate silently again. I'm thinking about creating a "isLogged" var and store it so that when someone logout and restart the app it will not even verify if the user is logged bypassing facebook session verify.

fb.getSession().closeAndClearTokenInformation(); 

you can use this. it worked for me.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top