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?
启动Facebook SDK 4.0,您需要调用
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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.