问题
I am trying to share an image with title and description on Facebook but it looks like when I set a Google PLay URL as the ContentUrl then the title and description are not displayed.
This is my code:
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentTitle("I want this car")
.setContentUrl(Uri.parse("http://www.producthunt.com"))
.setImageUrl(Uri.parse("http://www.topgear.com/uk/assets/cms/50b95ad3-7884-4b3d-ba3c-68dbeff8b737/Large%20Image%20(optional).jpg"))
.build();
shareDialog.show(linkContent);
}
The Result:
But when I set a Google Play URL as ContentURL:
if (ShareDialog.canShow(ShareLinkContent.class)) {
ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentTitle("I want this car")
.setContentDescription("This description should be displayed below the image but somehow it depends on the link.")
.setContentUrl(Uri.parse("https://play.google.com/store/apps/details?id=com.evernote"))
.setImageUrl(Uri.parse("http://www.topgear.com/uk/assets/cms/50b95ad3-7884-4b3d-ba3c-68dbeff8b737/Large%20Image%20(optional).jpg"))
.build();
shareDialog.show(linkContent);
}
The Result:
I tried this with other general and google play links and I always got the same result. What's wrong?
EDIT
I submitted this question to the Facebook team and even though they admitted that this is a bug I was told that they won't fix it any time soon. https://developers.facebook.com/bugs/1435972263375939
回答1:
I found 1 partial solution that may work depending on your requirements. Replace "https://play.google.com/store/apps/details?id=com.xxx.yyy" by a redirect address. I used one created in my Facebook app configuration "https://fb.me/xxxxxxxxxxxxxxx". The result of the share is working correctly with the custom contentDescription. The remaining issue is that the preview is not working in the "share to Facebook" popup ("A preview will be added after you post this to Facebook"). If you don't worry about your users seeing that preview this solution may work for you.
来源:https://stackoverflow.com/questions/30245720/google-play-url-messes-up-facebooks-share-dialog