简体   繁体   中英

Posting to Facebook Via Android Does not Show Image

I am trying to implement the Facebook share functionality in my app but when I click on the share button I get the following image:

在此处输入图片说明

Here's the code that I am using:

 ShareDialog shareDialog = new ShareDialog(ResultsActivity.this);
                if (ShareDialog.canShow(ShareLinkContent.class)) {
                   ShareLinkContent linkContent = new ShareLinkContent.Builder()
                            .setQuote("Hi Guys, I have completed Level " + level + " and I scored " + score + ". Can you beat my score?")                                                                                        
                            .setContentUrl(  Uri.parse("http://play.google.com/store/apps/details?id="
                                    + getPackageName()))
                            .build();

                    shareDialog.show(linkContent);

                }

The google play link works fine and it has icon image and the necessary images. When I was browsing for solution online, I found that Facebook OpenGraph Debugger helps in determining the cause. So, I used this link to look for any causes and Facebook was complaining about missing og:type as shown below:

在此处输入图片说明

What code should I add in android studio in order to fix this problem? Any help or suggestion will be greatly appreciated.

Ok, so the image finally appeared. I had to give it at least 6 hours for the image to appear. All I did was go back to the Facebook debugger link, and refresh my play store link and it showed me a preview with the image.

So if anyone is facing the same issue, please be patient. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM