Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 不使用应用程序在facebook上共享照片_Android_Facebook Sdk 4.0 - Fatal编程技术网

Android 不使用应用程序在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

如果没有安装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浏览器页面的内容?

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

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

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