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?
Android uses Intents and their associated extras to allow users to share information quickly and easily, using their favorite apps. Android provides two ways for users to share data between apps: The Android Sharesheet is primarily designed for sending content outside your app and/or directly to another user.
To share a post you see on your Feed: Below a post, tap Share in the bottom right. To share to a friend's timeline, tap Feed below your name, then select On a friend's timeline. Type your friend's name, then tap Share Now.
An intent allows you to start an activity in another app by describing a simple action you'd like to perform (such as "view a map" or "take a picture") in an Intent object.
To generate a Facebook Share Button, visit https://developers.facebook.com/docs/plugins/share-button and specify the URL you want people to share as well as the width. Then generate the code, and paste it into your site where you want the button to appear.
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..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With