【问题标题】:Share photo on facebook without app在没有应用程序的情况下在 Facebook 上分享照片
【发布时间】:2015-06-24 08:59:03
【问题描述】:

如果没有安装 facebook 应用程序,我正在尝试将用户重定向到浏览器以共享我的应用程序中的照片。

我正在使用:

        SharePhoto photo = new SharePhoto.Builder()
                .setImageUrl(Uri.fromFile(new File(path))
                .build();

        final SharePhotoContent content = new SharePhotoContent.Builder()
                .addPhoto(photo)
                .build();

        if (ShareDialog.canShow(SharePhotoContent.class)) {
           //Sharing via facebook app
            shareDialog.show(content);
        } else {
           //Sharing via browser
           Intent shareCaptionIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/userxxxx"));
           shareCaptionIntent.setType("image/*");

           //set photo
           shareCaptionIntent.setData(Uri.fromFile(new File(path)));
           shareCaptionIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(path)));

           context.startActivity(Intent.createChooser(shareCaptionIntent, "Share image using"));
        }

但是直到现在都没有任何成功。有没有办法分享重定向到 facebook 浏览器页面的内容?

【问题讨论】:

  • 我认为浏览器不会获得额外的数据。

标签: android facebook-sdk-4.0


【解决方案1】:

我也遇到过同样的麻烦,我可以说在 facebook 的SharePhotoContent API 中存在一些问题。你可以使用ShareLinkContent分享图片。

ShareLinkContent linkContent = new ShareLinkContent.Builder()
                .setImageUrl("Your url")
                .build();
shareDialog.show(linkContent);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-06
    • 2015-08-27
    • 1970-01-01
    • 2017-12-07
    • 1970-01-01
    • 2012-03-25
    • 2013-03-02
    • 1970-01-01
    相关资源
    最近更新 更多