I am making an application which gets just tweets from a specific page in android. I am using the twitter4j library version 3.0.5. Here is my code below:
@Override
protected String doInBackground(String... credentials) {
// TODO Auto-generated method stub
oAuth_ConsumerKey = credentials[0];
oAuth_ConsumerSecret = credentials[1];
accessToken = credentials[2];
accessTokenSecret = credentials[3];
System.out.println("Credentials -------- " + oAuth_ConsumerKey
+ "\n" + oAuth_ConsumerSecret + "\n" + accessToken + "\n"
+ accessTokenSecret);
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setOAuthConsumerKey(oAuth_ConsumerKey)
.setOAuthConsumerSecret(accessTokenSecret);
builder.setOAuthAccessToken(accessToken);
builder.setOAuthAccessTokenSecret(accessTokenSecret);
TwitterFactory twitterFactory = new TwitterFactory(builder.build());
Twitter twitter = twitterFactory.getInstance();
try {
List<twitter4j.Status> statuses;
String user = "@pagename";
statuses = twitter.getUserTimeline(user);
for (int i = 0; i < statuses.size(); i++) {
twitter4j.Status status = statuses.get(i);
Log.i("Tweet Count " + (i + 1), status.getText() + "\n\n");
}
} catch (TwitterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
(The above code is being done in the
doInBackground
method of theAsyncTask
. Just thought you should know)
And I am getting an error saying: No authentication challenges found. Relevant discussions can be found on the Internet at: ...
I viewed previous posts and it said to check my date and time. I did that and they are all correct and set to automatic. (Since i have a slow internet connection) I also tried running it on a faster internet connection. I now think that there is something wrong with my code.
I am new to integrating twitter to my android app so explanatory guidance would also be helpful along with the answer.
Thanks...