Reputation: 3647
I am doing a Twitter integration.
I do not know how to log out of Twitter.
I am using the following code to try logout... but it's just removing the tokens:
try
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
final Editor edit = prefs.edit();
edit.remove(OAuth.OAUTH_TOKEN);
edit.remove(OAuth.OAUTH_TOKEN_SECRET);
edit.commit();
}
catch(Exception e)
{
}
Upvotes: 1
Views: 2477
Reputation: 4024
You are not logging out of twitter. You are just removing the OAUTH_TOKEN
keys from internal storage (Shared Preferences
).
Upvotes: 3
Reputation: 8196
Try this
public void onTwitterLogout() {
// TODO Auto-generated method stub
if (mTwitter.hasAccessToken()) {
mTwitter.resetAccessToken();
} else{
Toast.makeText(context, "You are already logout", Toast.LENGTH_LONG).show();
}
}
Upvotes: 1