I am trying to implement Fabric to get a list of the last 5 tweets from the user. He worked perfectly for several hours, and then he stopped working. I would like to do this without a user logging in, and as far as I can tell, the API allows guest logins to read tweets, but maybe this has a bigger impact on speed limits?
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(this, new Twitter(authConfig), new Crashlytics());
TwitterCore.getInstance().logInGuest(new Callback() {
@Override
public void success(Result result) {
AppSession session = (AppSession) result.data;
getTweets();
}
@Override
public void failure(TwitterException exception) {
}
});
}
public void getTweets() {
TwitterApiClient twitterApiClient = TwitterCore.getInstance().getApiClient();
StatusesService statusesService = twitterApiClient.getStatusesService();
statusesService.userTimeline([USERID], null, 5, null, null, null, true, null, false, new Callback<List<Tweet>>() {
@Override
public void success(Result <List<Tweet>> result) {
for(Tweet Tweet : result.data) {
tweetList.add(Tweet.text);
}
createListView();
}
public void failure(TwitterException exception) {
Log.e("Failure", exception.toString());
exception.printStackTrace();
}
});
}
When I don't get 403, everything works fine and my list is populated.
Now, is it possible that there is something wrong with my code that fixes me in the black list? Otherwise; do I need a user to log in to show them 5 tweets? Or should I implement some kind of server cache?
Thanks for the tips / help.