问题
I am using facebook version 4.14 in my app inorder to share Hashtag along with Imageurl and Contenturl using ShareLinkConent. Now Hashtag is successfully posted inFacbook .
But unfortunately , in Facebook feed, imageurl is replaced by content url metadata. I am attaching the FaceBook feed screenshot here. In that instead of image url i am getting the Content Url metadata image. Please let me know what i am doing wrong here. I am posting my code below
ShareHashtag shareHashTag = new ShareHashtag.Builder().setHashtag(influencer.hashtag_name).build();
if (ShareDialog.canShow(ShareLinkContent.class) && !influencer.influencer_link.toString().equalsIgnoreCase("") && !influencer.influencer_link.toString().equalsIgnoreCase("null")) {
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse(influencer.influencer_link))
.setImageUrl(Uri.parse("https://d3kvf6cfq06287.cloudfront.net/influencer/image2_1469508676.jpg"))
.setShareHashtag(shareHashTag)
.setContentDescription(textd)
.build();
shareDialog.show(linkContent);
Also, I am using gradle depencies for FaceBook
compile 'com.facebook.android:facebook-android-sdk:[4.14.0]'
回答1:
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setShareHashtag(shareHashTag)
.setContentDescription(textd)
.setContentUrl(Uri.parse(influencer.influencer_link))
.setImageUrl(Uri.parse(selectedIceCreamImagePath)) //Uri.parse("https://d3kvf6cfq06287.cloudfront.net/influencer/image2_1469508676.jpg"))
.build();
shareDialog.show(linkContent, ShareDialog.Mode.FEED);
We need to open the ShareDialog with the Mode.FEED option.. Then our image will be posted correctly in FaceBook Feed
来源:https://stackoverflow.com/questions/39020477/facebook-sharelinkcontent-setimageurl-is-replaced-by-contenturl-metadata-in-andr