我的应用程序使用Android facebook sdk 3.0,登录后获得一些响应,之后我需要从facebook点击按钮注销.
如何从facebook中的会话注销帮助
Jor*_*cia 26
你应该做这样的事情.
if (Session.getActiveSession() != null) {
Session.getActiveSession().closeAndClearTokenInformation();
}
Session.setActiveSession(null);
Run Code Online (Sandbox Code Playgroud)
此外,如果您以其他方式存储用户令牌,您也应该清除它.
此方法将帮助您在android中以编程方式从facebook注销
/**
* Logout From Facebook
*/
public static void callFacebookLogout(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
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9139 次 |
| 最近记录: |