Search code examples
androidfacebookfacebook-sdk-4.0facebook-share

Sharing playstore app link with facebook share dialog selects incorrect picture


I want to share my apps playstore link with facebook from my app. I am using share dialog to share the link using the below code.

if (ShareDialog.canShow(ShareLinkContent.class)) {
            ShareLinkContent linkContent = new ShareLinkContent.Builder()
                    .setContentUrl(Uri.parse("https://play.google.com/store/apps/details?id=com.deadbrains.knowledgeup"))
                    .build();
            shareDialog.show(linkContent);
        } else {
            Toast.makeText(SlidingDrawerActivity.this, "Unable to Share...Try again.", Toast.LENGTH_SHORT).show();
        }

when I check with object debugger from here and add the following link https://play.google.com/store/apps/details?id=com.deadbrains.knowledgeup it shows the intended view which I want to share. see the image below enter image description here

but when I run the app and share it from there it looks like below enter image description here

What am I doing wrong? how can I correct this?


Solution

  • As discussed in the comments.

    You can use ShareLinkContent.Builder.setImageUrl(Uri uri) to set the image you intend to share, if you know the URL.