I'm trying to write a simple application that posts a tweet every time I run the program. I've been trying to figure out how to get the credentials, but I just can't figure it out. This is what I have so far:
public void tweet() {
try {
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setOAuthConsumerKey("consumer key here");
builder.setOAuthConsumerSecret("consumer secret here");
Configuration configuration = builder.build();
TwitterFactory factory = new TwitterFactory(configuration);
twitter = factory.getInstance();
twitter.updateStatus("test");
} catch (TwitterException e) {
e.printStackTrace();
}
}
To be clear, this isn't for a website or anything, it's just for when I run this program in eclipse, it should tweet for me.
If I'm not clear enough, please let me know!
You have to register an app at twitter: https://apps.twitter.com/ to get your token info. Read documentation for more info.