I use the LoginButton
from the Facebook Android SDK to login to my application. How do I programmatically log out the user from any Activity?
Starting Facebook SDK 4.0 you need to call
LoginManager.getInstance().logOut();
Can you use closeAndClearTokenInformation()
as described here: https://developers.facebook.com/docs/reference/android/current/class/Session/ ?
See also How to programmatically log out from Facebook SDK 3.0 without using Facebook login/logout button?
If you are using facebook SDK 4, you first need to initialize sdk:
FacebookSdk.sdkInitialize(getApplicationContext());
And then just do:
LoginManager.getInstance().logOut();
See here for more details.
If you are using facebook SDK 4, you first need to initialize sdk:
FacebookSdk.sdkInitialize(getApplicationContext());
And then :
LoginManager.getInstance().logOut();
AccessToken.setCurrentAccessToken(null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With