1
votes

I am currently trying out the Facebook for Android Share Dialog(https://developers.facebook.com/docs/android/share-dialog/) that was introduced in Facebook for Android SDK 3.5.

The code for starting the dialog is straight forward:

FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
     .setLink("https://developers.facebook.com/android")
     .build();
uiHelper.trackPendingDialogCall(shareDialog.present());

Similar to setLink() there is a setPicture(String url) method in FacebookDialog.ShareDialogBuilder. But I can't get this setPicture() method to work. I have tried to put Url to local image files, online images and also FB staged images (fbstage://...) but nothing seems to make any effect on the Share Dialog viewed or the resulting post.

Is there anyone that got the setPicture() method to work?

4
Do you see the post on facebook, but without the image or the post isn't shown at all?sromku
have you got it done, i have the same issue with local fileLiangWang
@sromku: I see the post but without image.semmelway
@Jacky: No, no progress yet. Have you managed to attach any picture at all?semmelway
@semmelway see my answer belowsromku

4 Answers

1
votes

from documentation of facebook feed

The picture must be at least 200px by 200px. 

And even more restriction on image to be, check here

This is an image associated with your media. We suggest that you use an image of at least 200x200 pixels. However, bigger is better, so if you have a 1500x1500 image that you can use, please use it. We'll downsample and crop it for for people using smaller-resolution devices but will use it on a larger device. The larger this image is, the more likely it will be used when sharing stories on Facebook. (Note: image sizes must be no more than 5MB in size.)

1
votes

With ShareDialogBuilder its not permitted to shared a local file but only remote files.

Currently I think that the only way (via a share dialog) is through the open graph action dialog.

0
votes

In order for you to call the setPicture() should be used with setLink().

Please refer to the article below. https://developers.facebook.com/docs/reference/android/current/class/FacebookDialog.ShareDialogBuilder/

-1
votes

You need to use an external URL like:

.setPicture("http://yourdomain.com/images/xyz.png");

Also, it will only display if you've set the link.