Tweets are not posted using Fabric

2019-09-18 09:27发布

I’m trying to post tweets form my android application. After the user authorize my application to use its account, normally the tweet have to be posted automatically but in my case, nothing happened. The authentication part works fine, the problem is in the share part. Using Fabric, this is how I post the tweet:

TwitterSession session = Twitter.getSessionManager().getActiveSession();
StatusesService statusesService = Twitter.getApiClient(session).getStatusesService();
statusesService.update(message, null, null, null, null, null, null, null, String.valueOf(new Callback<Tweet>() {
@Override
public void success(Result<Tweet> result) {
Log.d("Tweet", "post success");
}
@Override
public void failure(TwitterException e) {
e.printStackTrace();
}
}));

When I debug the success and the failure. I got any error, no exception, but nothing is posted. What is wrong with what I’m doing?

1条回答
戒情不戒烟
2楼-- · 2019-09-18 10:07

Try checking this its a lil bit old code

 try {


            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_SEND);
            intent.putExtra(Intent.EXTRA_SUBJECT, "");
            intent.putExtra(Intent.EXTRA_TEXT, "");
            intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
            intent.setType("text/plain");
            intent.setType("image/jpeg");
            intent.setPackage("com.twitter.android");
            startActivity(intent);
        } catch (Exception e) {
            commonAction.showToast("No twitter App Installed in device");
            Log.v("VM", "Exception while sending image on" + "com.twitter.android.PostActivity" + " " + e.getMessage());
        }
查看更多
登录 后发表回答