I am trying to use the Android share intent to post something on facebook. It looks like this:
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.setType("text/plain");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Free education for all! http://linkd.in/xU8mCc");
startActivity(shareIntent);
So my post has both - some text and a link. But when the message is posted on facebook, it only has the link, no message. I tried various extras but nothing works.
Anyone faced this issue and solved it? I have facebook app version 1.8.1
Edit: I tried removing the link, and the facebook app does not take my message (shows a blank message to be posted), but not the other way round. So looks like the app is totally ignoring any plain text messages. I am spooked! Is this a major bug in the fb app that text messages can not be posted at all (with share intent)?
In Lollipop (21), you can use
Intent.EXTRA_REPLACEMENT_EXTRAS
to override the intent for specific apps.https://developer.android.com/reference/android/content/Intent.html#EXTRA_REPLACEMENT_EXTRAS
In my app I have integrated Facebook SDK to enable users share the quote [ pre filled text ] on their wall. Using FB SDK, it is possible to do this. It works in my app and I have more than 5K users using the same.
Apparently this is not against the policy of FB as I have not had any warning or an issue where this did not work.
The code snippets for the same can be found here,
Do any widely used Android apps have Facebook sharing with pre-populated text field?
If you are going to use the regular Android Sharing Intents, then unfortunately the Facebook sharing intent can only take a single URL (make sure it has http://) and no additional text message. It is a strange limitation that doesn't really make sense.
You have to use the actual official separate Facebook Android SDK in your project to get the full sharing functionality. Which is extra work.
I ran in to similar issues. In the end, what I did was branch the intent. If they choose to share (in the regular android share intent) via Facebook, create a new share intent that only has the URL and push that to facebook. All other share options (twitter, message, email) would work like normal.
my question and solution are here:
Branching the Android Share Intent extras depending on which method they choose to share
I just built this code and it's working for me:
USe this code for share image ,video,link and text on facebook working perfectally