【问题标题】:Why android gallery can share images on facebook and SHARE INTENT on my app only urls?为什么 android 图库可以在 facebook 上共享图像并在我的应用程序仅 URL 上共享意图?
【发布时间】:2014-02-18 12:17:50
【问题描述】:

众所周知,Facebook 的分享意图非常有限,在 facebook 上你只能分享 url,不能分享文字,也不能分享图片,只能分享 url。

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "http://test.com");
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to)));

如果你用 facebook 试试这个,它不起作用:

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uriToImage);
shareIntent.setType("image/jpeg");
startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to)));

但是……我怎么可能在 facebook 上分享我的官方 android 画廊中的图像?

我确信有一种方法可以像官方 android 画廊那样在 facebook 上分享图片。 ¿如何实现?

PD:我需要在没有 facebook SDK 的情况下执行此操作,android gallery 不使用 facebook sdk。

【问题讨论】:

  • 我也对此感兴趣 - 你找到解决方案了吗?

标签: android android-intent share android-facebook android-sharing


【解决方案1】:

同时为文本指定 MIME 类型。 "text/plain" 是文本数据 MIME 的类型。尝试使用“/”作为 MIME,这样您就可以发送任何通用数据类型。

还可以尝试将 ACTION_SEND 更改为专门用于传递多个数据的 ACTION_SEND_MULTIPLE。

有关 ACTION_SEND_MULTPLE 和处理 MIME 类型的更多信息:

http://developer.android.com/reference/android/content/Intent.html

【讨论】:

  • 不,不行!!!请在 google 中搜索“facebook share intent android not working”。这是android的facebook分享意图的一个已知问题,你只能分享网址......
  • 我也来看看
  • 你检查过这个链接吗?虽然我并不完全同意答案,但它很有帮助
  • 什么链接?我看不到它
猜你喜欢
  • 2023-04-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多