javaandroidfacebookandroid-facebookfacebook-share

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:

enter image description here

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:

enter image description here

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


Solution

  • 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. :)