Example usage for twitter4j AsyncTwitter getOAuthRequestTokenAsync

List of usage examples for twitter4j AsyncTwitter getOAuthRequestTokenAsync

Introduction

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

Prototype

void getOAuthRequestTokenAsync(String callbackURL);

Source Link

Document

Retrieves a request token

Usage

From source file:com.marpies.ane.twitter.LoginActivity.java

License:Apache License

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mStopped = false;/*from w  w  w .j  a  v a2s.c o  m*/

    Bundle extras = getIntent().getExtras();
    boolean forceLogin = extras.getBoolean(EXTRA_PREFIX + ".forceLogin");

    /* If we have access tokens (user has logged in before) */
    if (TwitterAPI.hasAccessTokens()) {
        AIR.log("User is already logged in");
        AIR.dispatchEvent(AIRTwitterEvent.LOGIN_ERROR, "User is already logged in");
        finish();
    }
    /* Get new access tokens */
    else {
        final AsyncTwitter twitter = TwitterAPI.getAsyncInstance();
        twitter.addListener(getOAuthRequestTokenListener(forceLogin));
        twitter.getOAuthRequestTokenAsync(TwitterAPI.getCallbackURL());
    }
}