如何使用Android的Fabric Sdk从Twitter注销 [英] How to logout from twitter using Fabric Sdk for android

查看:107
本文介绍了如何使用Android的Fabric Sdk从Twitter注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用过

Twitter.getSessionManager().clearActiveSession();

这不起作用,下次当我使用Twitter登录时,它将打开浏览器对话框,使用以前的登录名,只是询问允许应用程序提取您的数据?",但不询问用户名和密码.帮助将不胜感激.

This does not work,next time when i logIn using twitter, it opens the dialog with browser,takes previous login and just asks "Allow app to fetch your data?", but doesn't ask for username and password.Any help will be appreciated.

推荐答案

我终于找到了解决这种情况的方法.

I finally found a solution to this situation.

偶然地,我在适用于Android的Twitter SDK工具包中找到了一种方法

Accidentally, I found a method in Twitter SDK Kit for Android

CookieSyncManager.createInstance(this);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.removeSessionCookie();
Twitter.getSessionManager().clearActiveSession();
Twitter.logOut();

这很简单,我花了大约半个小时才找到它.

This was very simple, it took me about half an hour to find it.

对于3.0及更高版本

For version 3.0 and above

CookieSyncManager.createInstance(this);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.removeSessionCookie();
TwitterCore.getInstance().getSessionManager().clearActiveSession()

这篇关于如何使用Android的Fabric Sdk从Twitter注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆