I setup my API keys a couple days ago, got my Android mobile app working with twitter4j yesterday, but today the app's twitter feed stopped working without any changes to the following code:
ArrayList<Tweet> tweets = new ArrayList<Tweet>();
try {
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey("xxx")
.setOAuthConsumerSecret("xxx")
.setOAuthAccessToken("xxx")
.setOAuthAccessTokenSecret("xxx");
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
Query query = new Query(searchTerm);
query.setCount(count);
QueryResult result = twitter.search(query);
for (Status status : result.getTweets()) {
//Log.d(TAG, "Screen Name " + status.getUser().getScreenName());
Tweet tweet = new Tweet(
status.getUser().getScreenName().toString(), //from_user
status.getText().toString(), //"text"
status.getUser().getBiggerProfileImageURL().toString(), //"profile_image_url"
status.getCreatedAt().toString()); //"created_at"
tweets.add(tweet);
}
}
catch (TwitterException e)
{
Log.d(TAG, "Error " + e.toString());
}
return tweets;
Populated with the correct OAuth keys, this is the TwitterException that is generated:
06-23 10:04:32.729: W/System.err(26432): org.apache.http.client.HttpResponseException: Gone
06-23 10:04:32.729: W/System.err(26432): at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:71) 06-23 10:04:32.734: W/System.err(26432): at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:59) 06-23 10:04:32.734: W/System.err(26432): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:773) 06-23 10:04:32.739: W/System.err(26432): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:743) 06-23 10:04:32.739: W/System.err(26432): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732) 06-23 10:04:32.739: W/System.err(26432): at com.campbellgolf.app.UTILS.ProxyNetworkTwitter.getTweets(ProxyNetworkTwitter.java:34) 06-23 10:04:32.739: W/System.err(26432): at com.campbellgolf.app.UI.ActivityTwitterFeed$1.run(ActivityTwitterFeed.java:175) 06-23 10:04:32.739: W/System.err(26432): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442) 06-23 10:04:32.739: W/System.err(26432): at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:322) 06-23 10:04:32.739: W/System.err(26432): at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:149) 06-23 10:04:32.739: W/System.err(26432): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:150) 06-23 10:04:32.744: W/System.err(26432): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265) 06-23 10:04:32.744: W/System.err(26432): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 06-23 10:04:32.744: W/System.err(26432): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 06-23 10:04:32.744: W/System.err(26432): at java.lang.Thread.run(Thread.java:856)