Android 不使用应用程序在facebook上共享照片
如果没有安装facebook应用程序,我正在尝试将用户重定向到浏览器以共享我应用程序中的照片 我正在使用:Android 不使用应用程序在facebook上共享照片,android,facebook-sdk-4.0,Android,Facebook Sdk 4.0,如果没有安装facebook应用程序,我正在尝试将用户重定向到浏览器以共享我应用程序中的照片 我正在使用: SharePhoto photo = new SharePhoto.Builder() .setImageUrl(Uri.fromFile(new File(path)) .build(); final SharePhotoContent content = new SharePhotoCon
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);
我认为浏览器不会获得额外的数据。