gpt4 book ai didi

android - 在没有应用程序的情况下在 Facebook 上分享照片

转载 作者:行者123 更新时间:2023-11-29 20:40:45 24 4
gpt4 key购买 nike

如果没有安装 Facebook 应用程序,我会尝试将用户重定向到浏览器以共享来 self 的应用程序的照片。

我正在使用:

        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 浏览器页面的内容?

最佳答案

我遇到过同样的麻烦,我可以说 facebook 的 SharePhotoContent API 存在一些问题。您可以使用 ShareLinkContent 共享图像。

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

关于android - 在没有应用程序的情况下在 Facebook 上分享照片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31022125/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com