Example usage for twitter4j TwitterMethod OAUTH_ACCESS_TOKEN

List of usage examples for twitter4j TwitterMethod OAUTH_ACCESS_TOKEN

Introduction

In this page you can find the example usage for twitter4j TwitterMethod OAUTH_ACCESS_TOKEN.

Prototype

TwitterMethod OAUTH_ACCESS_TOKEN

To view the source code for twitter4j TwitterMethod OAUTH_ACCESS_TOKEN.

Click Source Link

Usage

From source file:com.marpies.ane.twitter.data.TwitterAPI.java

License:Apache License

public static void getAccessTokensForPIN(String PIN) {
    final AsyncTwitter twitter = getAsyncInstance();
    twitter.addListener(new TwitterAdapter() {
        @Override/*from   ww w. java2s  .  c o  m*/
        public void gotOAuthAccessToken(AccessToken token) {
            AIR.log("Retrieved access tokens");
            /* Store access tokens */
            TwitterAPI.storeAccessTokens(token);
            AIR.dispatchEvent(AIRTwitterEvent.LOGIN_SUCCESS);
        }

        @Override
        public void onException(TwitterException te, TwitterMethod method) {
            if (method == TwitterMethod.OAUTH_ACCESS_TOKEN) {
                AIR.dispatchEvent(AIRTwitterEvent.LOGIN_ERROR, StringUtils.removeLineBreaks(te.getMessage()));
            }
        }
    });
    twitter.getOAuthAccessTokenAsync(mRequestToken, PIN);
}