I am using Firebase Dynamic Links in my Android app, as previously mentioned, and it is working well. The problem is that when I share it, for example in WhatsApp, the link does not show the image, while it is showing title and description. The type of link used is the short one (using the large one, it works perfectly).
This is my code:
FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLongLink(buildDynamicLink())
.buildShortDynamicLink(ShortDynamicLink.Suffix.SHORT)
.addOnCompleteListener(new OnCompleteListener<ShortDynamicLink>() {
@Override
public void onComplete(@NonNull Task<ShortDynamicLink> task) {
if (task.isSuccessful()) {
//Uri previewLink = task.getResult().getPreviewLink();
Uri shortLink = task.getResult().getShortLink();
shareApp(shortLink.toString());
} else {
Toast.makeText(MainActivity.this, task.getException().getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
buildDynamicLink method:
private Uri buildDynamicLink(){
String uri = "https://appname.page.link/" +
"?link=" + "https://www.appname.com/" +
"&apn=" + getPackageName() +
"&ibn=" + "name" +
"&st=" + "Title" +
"&sd=" + "Description" +
"&si=" + "validImageUrl";
return Uri.parse(uri);
Share Intent
private void shareApp(String uri){
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT,uri);
intent.setType("text/plain");
startActivity(intent);
}
Can anyone help me with this issue?
Thank you all in advance.