Share text and URL on Facebook

user2041902 picture user2041902 · Apr 10, 2013 · Viewed 11.1k times · Source

I want to share a message such as " Check out the image http://someUrl.com Shared from app ABCapp. The user must be able to choose any of the installed applications to share with. I am using the following code

Intent intent = new Intent(android.content.Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
        intent.putExtra(Intent.EXTRA_TEXT, shareMsg);
        startActivity(Intent.createChooser(intent,
                getString(R.string.share_using_application)));

It works fine for all other applications other than facebook. I have read some other questions which suggest to use facebook sdk. I am not very clear with what am I supposed to use fb sdk for? I want the list of applications to be shown on click of share option, after that am i supposed to take a different approach if user selects FB? Can the user's selection be detected? Please explain.

Answer

EvZ picture EvZ · Apr 10, 2013

You need to use Facebook Android SDK or Easy Facebook Android SDK to share.