【问题标题】:Tweets are not posted using Fabric不使用 Fabric 发布推文
【发布时间】:2017-08-22 19:38:51
【问题描述】:

我正在尝试从我的 android 应用程序中发布推文。在用户授权我的应用程序使用其帐户后,通常必须自动发布推文,但在我的情况下,什么也没发生。身份验证部分工作正常,问题出在共享部分。使用 Fabric,这就是我发布推文的方式:

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();
}
}));

当我调试successfailure 时。 我有任何错误,没有例外,但没有发布任何内容。 我在做什么有什么问题?

【问题讨论】:

  • 只是为了来自登录用户的推文?您可以简单地使用意图
  • 我想从我的应用程序中发布推文,但使用已连接的用户帐户
  • @GIBINTHOMAS 你能解释一下吗?

标签: android twitter twitter-fabric


【解决方案1】:

试着检查一下这个有点旧的代码

 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());
        }

【讨论】:

  • 为什么我的 StatusesService 不匹配?
  • 原谅你是什么意思/
  • 我的意思是我为什么要使用 Intent 而不是 StatusesService?在这种情况下,意图是否比 StatusesService 更适应?
  • 我不知道使用您的数据发布推文,您可以使用意图
  • 它有效,但我想直接发布它,而不询问用户是否必须通过消息或推文分享。我想在“允许”成功后直接发布
猜你喜欢
  • 1970-01-01
  • 2023-04-09
  • 2017-02-22
  • 1970-01-01
  • 2013-10-20
  • 2021-04-11
  • 2012-05-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多