1

众所周知,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 库不使用 facebook sdk。

4

1 回答 1

0

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

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

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

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

于 2014-02-18T12:22:27.443 回答