Question

When posting a link on Facebook, the link to an article is automatically parsed, displays the link, article title, short description, and a thumbnail.

I want to do the same thing, but from my android app. I have set up the Facebook SDK already and the log in feature and request for permission is already working fine. However, I don't know how to proceed with sharing a link on Facebook, and automatically let Facebook handle the parsing.

I also want to display the Facebook post dialog, so that the user can add a personal message with the shared link. Right now, I'm using the dialog method of Facebook but it doesn't work. It doesn't even display the dialog box. Any ideas?

Bundle parameters = new Bundle();
parameters.putString("link", link);
// post on user's wall.
facebook.dialog(context, "feed", parameters, new PostDialogListener());
Was it helpful?

Solution 2

Finally, I got this to work. It turns out that the code I'm using above is working fine. The problem was that I was getting a facebook error due to incorrect hash key.

OTHER TIPS

add the below code where you need to share your link

intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(android.content.Intent.EXTRA_TEXT,"https://Your Link");
intent.putExtra(android.content.Intent.EXTRA_STREAM,R.drawable.icon);
startActivity(Intent.createChooser(intent, "Your Chooser Title"));

not sure if this is in the right place but i had issues linking a website to facebook... the link worked fine for desktops but not for androids... i simply wanted an add as friend link and to enable it to work for desktops and androids the following worked for me

http://en-gb.facebook.com/(username here for facebook page)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top