Facebook Share image Url with link in android

I want to share a graphic URL with a link. I used to use shareLinkContent to share the image and URL, but now it does not work.

                        shareDialog = new ShareDialog(activity);

                        ShareLinkContent content = new ShareLinkContent.Builder()

                                .setImageUrl(Uri.parse(image)).setContentUrl(Uri.parse(shareUrl))

                                .build();
                        shareDialog.show(content);

this is my code, which it only divides into content. Url does not use an image Url.Is there is another way to share the link with the image on Facebook. Please help me solve this problem.

+4
source share
2 answers

Facebook Doc

As of April 18, 2017, the following parameters are no longer supported by the charting API version 2.9 or higher. For versions 2.8 and below, the parameters will continue to work until July 17, 2017.

  • contentTitle,
  • imageURL, URL- ,
  • contentDescription , 2-4
+1
private void sharePhotoToFacebook() {
    Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.b);
    SharePhoto photo = new SharePhoto.Builder()
            .setBitmap(image)
            .build();
    SharePhotoContent content = new SharePhotoContent.Builder()
            .addPhoto(photo)
            .build();
    ShareApi.share(content, null);

}
0

Source: https://habr.com/ru/post/1681165/


All Articles