share using intent to facebook in android

2019-02-17 10:24发布

问题:

I use the following code to share content

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "The status update text");
startActivity(Intent.createChooser(intent, "Dialog title text"));

It is OK for email, sms and whatever except Facebook. I google the reason and it seems that it is a bug of facebook since April but unfortunately no one fixes it.

However, I find that many app can still use intent chooser to invoke Facebook successfully such as Google reader. How can they do it?

As I know, we can use Facebook API, but how they can know user choose facebook in the chooser and invoke the facebook API?

回答1:

According to the latest updating to the bug tracker this is 'By Design' and the bug has been closed. https://developers.facebook.com/bugs/332619626816423/

So looks like this isn't going to be possible via intents..



回答2:

You could only send pure URL to facebook. It should be a bug on facebook App.

For more detailed information, refer to the following post

Share Text on Facebook from Android App via ACTION_SEND


Someone has posted this issue to official facebook bug tracker, but it's still not solved yet.

Bug 16728 - Android ACTION_SEND is not handled correctly