List of usage examples for twitter4j.conf ConfigurationBuilder setDebugEnabled
public ConfigurationBuilder setDebugEnabled(boolean debugEnabled)
From source file:com.example.leonid.twitterreader.Twitter.TwitterGetTweets.java
License:Apache License
@Override protected List<CreateTweet> doInBackground(String... params) { mTweetsInfo = new ArrayList<>(); List<String> texts = new ArrayList<>(); List<String> titles = new ArrayList<>(); List<String> images = new ArrayList<>(); List<String> date = new ArrayList<>(); if (!isCancelled()) { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey(CONSUMER_KEY).setOAuthConsumerSecret(CONSUMER_SECRET) .setOAuthAccessToken(ACCESS_KEY).setOAuthAccessTokenSecret(ACCESS_SECRET); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); //query search result Query query = new Query(params[0]); //how much tweets need to be displayed(max 200) query.count(200);//from w w w . j ava 2 s. c om try { mResult = twitter.search(query); for (twitter4j.Status status : mResult.getTweets()) { if (!isCancelled()) { texts.add(status.getText()); titles.add(status.getUser().getName()); images.add(status.getUser().getBiggerProfileImageURL()); String cleanDate = status.getCreatedAt().toString(); date.add(cleanDate.substring(0, cleanDate.length() - 15) + " " + cleanDate.substring(cleanDate.length() - 4)); } } } catch (TwitterException e) { Log.e("exeption", e.toString()); } //loop teuth results and create array list for list view for (int i = 0; i < texts.size(); i++) { mTweetsInfo.add(new CreateTweet(titles.get(i), images.get(i), texts.get(i), date.get(i))); } } return mTweetsInfo; }
From source file:com.freedomotic.plugins.devices.twitter.gateways.TwitterGateway.java
License:Open Source License
public static synchronized Twitter getInstance(Config configuration) { if (twitter == null) { ConfigurationBuilder cb = new ConfigurationBuilder(); //TODO: create a default twitter account for freedom project. If the user do not customize the oauth parameters in //config file we can use by default the parameters of the freedom twitter account (the second argument in getStringProperty). cb.setDebugEnabled(true).setOAuthConsumerKey(configuration.getStringProperty("OAuthConsumerKey", null)) //"TLGtvoeABqf2tEG4itTUaw") .setOAuthConsumerSecret(configuration.getStringProperty("OAuthConsumerSecret", null)) //"nUJPxYR1qJmhX9SnWTBT0MzO7dIqUtNyVPfhg10wf0") .setOAuthAccessToken(configuration.getStringProperty("OAuthAccessToken", null))//"312792183-adnYVIv06spR4qsI3eKVv53CfrYHl3KqgtJtYm10") .setOAuthAccessTokenSecret(configuration.getStringProperty("OAuthAccessTokenSecret", null));//("Br2O2wtZ2dsLMDN21qKdlCLsOuqXW8h3z3uButRk"); TwitterFactory tf = new TwitterFactory(cb.build()); twitter = tf.getInstance();//from w w w . j ava2 s. co m } return twitter; }
From source file:com.fuzuapp.model.resultados.TwitterAdapter.java
private void inicializar() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey("56dJMai5O3H1MUjUl607LPgOh") .setOAuthConsumerSecret("wLsRXEDxDWAgOW217XbSiSK1J2WNG2gqxVDuLIqreI5VYfKEyD") .setOAuthAccessToken("64546879-myofEJ5cfPHwaRIud8mSBq2BmM68gHo9gGNgvj8Qb") .setOAuthAccessTokenSecret("dzJYWMs4QJUAwOCTisg5eSVLT5xhTp61ecuZ6fNpnARAI"); TwitterFactory tf = new TwitterFactory(cb.build()); twitter = tf.getInstance();// w ww. j a v a 2 s .c om }
From source file:com.github.altyjp.webChangeDetector.TweetStrings.java
/** * ?//from w ww .ja v a 2 s. c o m * * @param str_tweet * @throws TwitterException */ public void tweetString(String str_tweet) throws TwitterException { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey(ConsumerKey).setOAuthConsumerSecret(ConsumerSecret) .setOAuthAccessToken(AccessToken).setOAuthAccessTokenSecret(AccessTokenSecret); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); //User user = twitter.verifyCredentials(); //? //System.out.println("???" + user.getName()); //System.out.println("?????" + user.getScreenName()); //System.err.println("???" + user.getFriendsCount()); //System.out.println("????" + user.getFollowersCount()); //?????? Status status = twitter.updateStatus(str_tweet); }
From source file:com.ibuildapp.romanblack.CameraPlugin.SharingActivity.java
License:Open Source License
/** * Reinitializes twitter credentials./*w ww . ja va 2 s .co m*/ * @return the twitter instance */ private Twitter reInitTwitter() { com.appbuilder.sdk.android.authorization.entities.User twitterUser = Authorization .getAuthorizedUser(Authorization.AUTHORIZATION_TYPE_TWITTER); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.setDebugEnabled(true).setOAuthAccessToken(twitterUser.getAccessToken()) .setOAuthAccessTokenSecret(twitterUser.getAccessTokenSecret()) .setOAuthConsumerSecret(Statics.TWITTER_CONSUMER_SECRET) .setOAuthConsumerKey(Statics.TWITTER_CONSUMER_KEY); Configuration configuration = builder.build(); return new TwitterFactory(configuration).getInstance(); }
From source file:com.ijuru.tweetgrab.Context.java
License:Open Source License
/** * Starts the application/*from w w w .j ava 2s . c om*/ * @throws Exception */ public static void startApplication() throws Exception { // Look for environment variable or system property String optionsJSON = System.getenv(ENVVAR_NAME); if (optionsJSON == null) { optionsJSON = System.getProperty(JVMPROP_NAME); if (optionsJSON == null) { throw new Exception("Could not find environment variable (" + ENVVAR_NAME + ") or JVM property (" + JVMPROP_NAME + ")"); } } ObjectMapper mapper = new ObjectMapper(); options = mapper.readValue(optionsJSON, Options.class); ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(false).setOAuthConsumerKey(options.getCredentials().get("consumerKey")) .setOAuthConsumerSecret(options.getCredentials().get("consumerSecret")) .setOAuthAccessToken(options.getCredentials().get("accessToken")) .setOAuthAccessTokenSecret(options.getCredentials().get("accessTokenSecret")); twitterFactory = new TwitterFactory(cb.build()); }
From source file:com.infine.android.devoxx.service.TwitterService.java
License:Apache License
@Override public void onCreate() { super.onCreate(); ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey("************").setOAuthConsumerSecret("****************") .setOAuthAccessToken("***************").setOAuthAccessTokenSecret("**************"); TwitterFactory tf = new TwitterFactory(cb.build()); mTwitter = tf.getInstance();/*from w ww . j a v a2 s .c o m*/ mResolver = getContentResolver(); }
From source file:com.isdp.twitterposter.TwitterManager.java
License:Open Source License
public void initTwitter() { ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); configurationBuilder.setDebugEnabled(true).setOAuthConsumerKey(OAUTH_CONSUMER_KEY) .setOAuthConsumerSecret(OAUTH_CONSUMER_SECRET).setOAuthAccessToken(OAUTH_ACCESS_TOKEN) .setOAuthAccessTokenSecret(OAUTH_ACCESS_TOKEN_SECRET); configuration = configurationBuilder.build(); }
From source file:com.k42b3.xoxa.TwitterBot.java
License:Open Source License
public TwitterBot(String host, int port, String nick, String pass, String channel, boolean ssl, int minInterval, int maxInterval, String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret) { super(host, port, nick, pass, channel, ssl, minInterval, maxInterval); try {/*from w w w . j a v a2s. c o m*/ ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey(consumerKey).setOAuthConsumerSecret(consumerSecret) .setOAuthAccessToken(accessToken).setOAuthAccessTokenSecret(accessTokenSecret); TwitterFactory tf = new TwitterFactory(cb.build()); this.twitter = tf.getInstance(); User user = this.twitter.verifyCredentials(); logger.info("Connected to twitter account " + user.getName()); } catch (Exception e) { logger.warning(e.getMessage()); } }
From source file:com.krossovochkin.kwitter.activities.MainActivity.java
License:Apache License
private void initTwitter() { boolean authDataExists = Settings.getBoolean(this, Settings.AUTH_DATA_EXISTS, false); if (authDataExists) { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(BuildConfig.DEBUG).setOAuthConsumerKey(getString(R.string.twitter_consumer_key)) .setOAuthConsumerSecret(getString(R.string.twitter_consumer_secret)) .setOAuthAccessToken(Settings.getString(this, Settings.ACCESS_TOKEN_KEY)) .setOAuthAccessTokenSecret(Settings.getString(this, Settings.ACCESS_TOKEN_SECRET_KEY)) .setJSONStoreEnabled(true); TwitterFactory tf = new TwitterFactory(cb.build()); mTwitter = tf.getInstance();//from w ww . java 2 s.c om } else { startActivity(new Intent(this, AuthActivity.class)); finish(); } }