【问题标题】:Sharing to Facebook with ACTION_SEND_MULTIPLE使用 ACTION_SEND_MULTIPLE 分享到 Facebook
【发布时间】:2025-12-11 04:15:02
【问题描述】:

我一直在尝试使用ACTION_SEND_MULTIPLE Intent 将一些图片分享到 Facebook。

我为此编写的代码是。

ArrayList<Uri> imageUris = new ArrayList<Uri>();
    for (DeviceImage image : catchImagesURI) {
        Log.d(TAG, "onClickShareFB: image uri " + image.getImageURI());
        imageUris.add(image.getImageURI());
    }
    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
    shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
    shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    shareIntent.setType("image/png");
    startActivity(Intent.createChooser(shareIntent, "Share images to.."));
}

其中图片的 Uri 是 /storage/emulated/0/DCIM/Screenshot_1497529599.png/storage/emulated/0/DCIM/calendar.png

当我从我得到的选项中选择 Facebook 时

Image Uri 的格式有问题还是我这样做完全错了?

【问题讨论】:

  • 您是否添加了读写外部存储的权限
  • 这也是我认为的错误,但是当我添加权限时没有任何改变

标签: android facebook android-intent share


【解决方案1】:

Image Uri 的格式有问题吗

它们不是有效的Uri 值。 Uri 有一个方案。例如,https://*.com/questions/46152988/sharing-to-facebook-with-action-send-multiple 是一个Uri,其方案为https。鉴于您使用的路径,大概该方案应该是file

Facebook 是否可以使用指向外部存储的 file Uri 值是另一回事。应该可以吧。

【讨论】: