Example usage for twitter4j AsyncTwitter getOAuthAccessTokenAsync

List of usage examples for twitter4j AsyncTwitter getOAuthAccessTokenAsync

Introduction

In this page you can find the example usage for twitter4j AsyncTwitter getOAuthAccessTokenAsync.

Prototype

void getOAuthAccessTokenAsync(RequestToken requestToken, String oauthVerifier);

Source Link

Document

Retrieves an access token associated with the supplied request token and sets userId.

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 .  j  av a2 s.c  om*/
        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);
}