Roger Travis
Roger Travis

Reputation: 8538

posting text & image to Facebook from my app

I need to make my app post an image with some text to facebook.

Here's my code

               Intent shareIntent = new Intent(Intent.ACTION_SEND);

                shareIntent.setType("image/jpg");
                shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
                shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "text1");
                shareIntent.putExtra(Intent.EXTRA_TEXT, "text2");

                startActivity(Intent.createChooser(shareIntent, "Share via..."));

It does post the image fine, but I can't find a way how to attach text to it.

enter image description here

While, for example, in instagram it does post both text & photo fine. Also notice the posting window is different.

enter image description here

Any ideas? Thanks!

Upvotes: 1

Views: 1721

Answers (1)

dorjeduck
dorjeduck

Reputation: 7794

What by many android developer is classified as a bug in the facebook app is actually from their point of view a valid design decision.

Discussion on facebook Android Intent Sharing is Broken

... Our FB app handles the intent because it is an effective way for users to share content such as links (e.g. your app URL) on their Facebook. However, like I mentioned earlier, it is against our policy to pre-fill the message for our users because it erodes the authenticity of the user voice so our app does not accept the EXTRA_* fields . ...

Upvotes: 1

Related Questions