I want to get the tweet id from Tweet Composer, but seem it’s impossible (or at least i can not find answers), so I use Card instead. Here is my code:
TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();
if(session == null) {
twitterAuthClient.authorize(PreviewActivity.this, new com.twitter.sdk.android.core.Callback() {
@Override
public void success(Result result) {
if(result != null && result.data != null) {
Card card = new Card.AppCardBuilder(PreviewActivity.this)
.imageUri(Uri.fromFile(new File(mUrl)))
.googlePlayId(“com.pixel.gun3d”)
.build();
Intent intent1 = new ComposerActivity.Builder(PreviewActivity.this)
.session(result.data)
.card(card)
.createIntent();
startActivity(intent1);
}
}
@Override
public void failure(TwitterException exception) {}
});
//mLoginTwitter.performClick();
} else {
Card card = new Card.AppCardBuilder(PreviewActivity.this)
.imageUri(Uri.fromFile(new File(mUrl)))
.googlePlayId("com.pixel.gun3d")
.build();
Intent intent1 = new ComposerActivity.Builder(PreviewActivity.this)
.session(session)
.card(card)
.createIntent();
startActivity(intent1);
}
And here is my BroadcastReceiver:
public class TwitterResultReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (TweetUploadService.UPLOAD_SUCCESS.equals(intent.getAction())) {
// success
final Long tweetId = intent.getExtras().getLong(TweetUploadService.EXTRA_TWEET_ID);
}
}
}
I also register this broadcast in manifest.
The problem is, when I use TweetComposer, although it can not get tweet id, it can send text and image, but when I use Card, it always return UPLOAD_FAILED and does not post tweet (but no crash nor error).
I don’t know what’s wrong ? Can you tell me how to fix it and get tweet id after post it. And, I also want to ask one more thing. Can I get follower list of user. I see that twitter api can get it, but I research fabric twitter kit and doesn’t see any function to get follower list. If you know example code, please tell me.
Thank you very much