Yarin Shitrit
Yarin Shitrit

Reputation: 327

Facebook share link with metadatas from android app

I implement sharing on facebook in my android app and according to facebook share sdk for android there is no option to share a link that will look like this :

enter image description here

As I dived into the docs - https://developers.facebook.com/docs/sharing/webmasters/ I see that there is only option to add these metadatas that will eventually show the link as the above only from facebook javascript sdk ? how can I make the link that I share from the android app also appear like that ? If my app uses firebase and cloud functions with Node.js, can I somehow make a function that will work it out ?

Thanks in advance

Upvotes: 3

Views: 385

Answers (1)

Praveen Thirumurugan
Praveen Thirumurugan

Reputation: 1077

There is no way to add a custom title, description or image for the links you share to Facebook and other popular social media services. When you share a link in the text area of the Facebook post or a Twitter tweet, they check for the meta tags in the link.

For example, if you visit https://stackoverflow.com, you can check the meta tags associated with the site by inspecting the page using your browser.

<meta property="og:type" content= "website" />
<meta property="og:url" content="https://stackoverflow.com/"/>
<meta property="og:site_name" content="Stack Overflow" />
<meta property="og:image" itemprop="image primaryImageOfPage" content="https://cdn.sstatic.net/Sites/stackoverflow/Img/[email protected]?v=73d79a89bded" />

<meta name="twitter:card" content="summary"/>
<meta name="twitter:domain" content="stackoverflow.com"/>
<meta name="twitter:title" property="og:title" itemprop="name" content="Stack Overflow - Where Developers Learn, Share, &amp; Build Careers" />
<meta name="twitter:description" property="og:description" itemprop="description" content="Stack Overflow | The World&#x2019;s Largest Online Community for Developers" />

If you see above, there are two sections in the HTML with meta tags starting with og: and twitter:. These are meta tags instructing the mediums to use the data available here for displaying the title, description and image - i.e. on the Facebook post in your case.

Learn more about the Open Graph Protocol (og) here.

Upvotes: 3

Related Questions