I need to create logout method in my Android application.
How can i do this ? I need to remove preference to logout ?
I tried to do:
mFacebook.logout(getContext())
but it doesn’t work.
UPDATE
I tried with this code:
mAsyncRunner.logout(this, new RequestListener() {
@Override
public void onComplete(String response, Object state) {
Log.d("Logout from Facebook", response);
if (Boolean.parseBoolean(response) == true) {
// User successfully Logged out
}
else{
}
}
@Override
public void onIOException(IOException e, Object state) {
}
@Override
public void onFileNotFoundException(FileNotFoundException e,
Object state) {
}
@Override
public void onMalformedURLException(MalformedURLException e,
Object state) {
}
@Override
public void onFacebookError(FacebookError e, Object state) {
}
});
Same problem. In LogCat I see “Logout from Facebook | true”, but if I open my app again (after finish) I’m logged in.
You don’t need an AsyncRunner to logout, logging out is a one line code
where mFB is of type Facebook. (the one which you used for logging in)
Make sure you clear the Access Token (if you had saved that)….
Hope the explanation was useful…