Hi,
I am in the process of writing a mobile app which makes use of the Twitter/Fabric SDK. While logging in is not a problem, it seems that I can’t use an existing TwitterSession
with the StatusesService
.
Here’s what I have (s_timeline.m_session
is a “global” storage for a TwitterSession
):
s_timeline.m_session = Twitter.getSessionManager().getActiveSession();
if (!s_timeline.m_session.getUserName().isEmpty()) {
Log.i("tweet", s_timeline.m_session.getUserName());
// echoes the correct user name!
TwitterAuthToken authToken = s_timeline.m_session.getAuthToken();
s_auth = new TwitterAuthToken(authToken.token, authToken.secret);
}
StatusesService statusesService = Twitter.getApiClient().getStatusesService();
statusesService.homeTimeline(1, null, null, true, null, null, null, new Callback<List<Tweet>>() {
@Override
public void success(Result<List<Tweet>> result) {
List<Tweet> tweets = result.data;
s_timeline.setTweet(tweets.get(0).text);
Log.i("tweet", "success(): " + s_timeline.getTweet());
}
@Override
public void failure(TwitterException e) {
Log.i("tweet", "wtf? " + e.getMessage());
}
});
String latestTweet = s_timeline.getTweet();
The String
is never filled, neither success
nor failure
are ever called. What do I do wrong?