Followers

About Me

Senin, 18 Maret 2013

twitter4j logout example

Did you ever try logout twitter4j and can not login again ?

Just in case anyone wanted to know how to clear the user’s credentials from the Twitter webview… (In addition to clearing the access token from the app’s shared preferences, this modification forces the user to re-enter their username and password on the Twitter webview when signing back-on).

1. You can try to edit resetAccessToken function in TwitterApp.java with :


public void resetAccessToken(Context context) {
if (mAccessToken != null) {
mSession.resetAccessToken(); //clear webview cookies (in case user saved credentials on Twitter webview)
CookieSyncManager.createInstance(context);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.removeAllCookie(); mAccessToken = null;
}
}

2. You can try to call the function from main activity with :

mTwitter.resetAccessToken(this);


=================
reference (John Nogueira)


0 komentar: