Example usage for twitter4j TwitterStreamFactory getInstance

List of usage examples for twitter4j TwitterStreamFactory getInstance

Introduction

In this page you can find the example usage for twitter4j TwitterStreamFactory getInstance.

Prototype

public TwitterStream getInstance(Authorization auth) 

Source Link

Document

Returns a instance.

Usage

From source file:br.shura.team.mpsbot.runtime.ConnectedBot.java

License:Open Source License

public void connect() {
    ApiKeys keys = getBot().getApiKeys();

    if (!isConnected()) {
        Configuration configuration = new ConfigurationBuilder().setOAuthAccessToken(keys.getAccessToken())
                .setOAuthAccessTokenSecret(keys.getAccessTokenSecret())
                .setOAuthConsumerKey(keys.getConsumerKey()).setOAuthConsumerSecret(keys.getConsumerSecret())
                .build();//  w ww  .  j a v a  2s .com
        OAuthAuthorization auth = new OAuthAuthorization(configuration);
        TwitterStreamFactory streamFactory = new TwitterStreamFactory(configuration);
        ImageUploadFactory uploadFactory = new ImageUploadFactory(configuration);

        this.streamer = streamFactory.getInstance(auth);
        this.uploader = uploadFactory.getInstance(auth);
    }
}