Reputation: 547
Having issue when posting Branch.io links to WhatsApp or Facebook, sometimes image will show and sometimes not.
Below is the code of branch.io url generation in my android app:
BranchUniversalObject buo = new BranchUniversalObject();
buo.setCanonicalIdentifier(itemMap.get(Constants.TAG_ID));
buo.setTitle(itemMap.get(Constants.TAG_TITLE));
buo.setContentDescription(des);
buo.setContentIndexingMode(BranchUniversalObject.CONTENT_INDEX_MODE.PUBLIC);
buo.setContentMetadata(new ContentMetadata().addCustomMetadata("itemid", itemMap.get(Constants.TAG_ID)));
if (photosAry.size() > 0) {
buo.setContentImageUrl(photosAry.get(0));
Log.v("BRANCH ", "photosAry@0: " + photosAry.get(0));
}
LinkProperties lp = new LinkProperties()
.setChannel("Android")
.setFeature("sharing")
.setCampaign("GoCar2 AppLink Sharing")
.setStage("user")
.addControlParameter("$desktop_url", itemMap.get(Constants.TAG_PROURL))
.addControlParameter("itemid", itemid);
buo.generateShortUrl(this, lp, new Branch.BranchLinkCreateListener() {
@Override
public void onLinkCreate(String url, BranchError error) {
if (error == null) {
branchurl = url;
Log.i("BRANCH SDK", "got my Branch link to share: " + url);
}
}
});
*In most cases, photosary will have at least 1 image, and I am adding image to the branch object when it confirms photosary has at least 1 image in order to prevent crash when photosary is empty.
This is the log and the branch url link created:
V/BRANCH: photosAry@0: https://gocar2.com/media/item/103323/15234540442780.jpg
I/BRANCH SDK: got my Branch link to share: https://gocar2.app.link/TeJ3bj261L
The image only show when I am posting with Facebook App, but image is not showing when posting on Facebook Desktop ver. or WhatsApp.
Upvotes: 0
Views: 1182
Reputation: 169
For any social media content sharing, I would recommend visiting the Facebook OG Debugger. I scraped your link and noticed that there are a few errors, which might be preventing your link from displaying properly on all channels. Please fix these errors, rescrape the link, and repost it to see if this resolves your issue.
Upvotes: 0