I want to know if I can share only text (without any link) to a facebook wall/timeline using facebook android SDK?
Because iOS social framework let me publish predefined text in a share dialog and android share intent doesn't let me modify the text to share (by code) and it seems to me that the facebook android SDK, only permits to share text if this comes with a link.
So how can I directly publish a text/message to a facebook timeline?
I have written a step by step procedure to post only text in facebook wall !
Follow this https://stackoverflow.com/a/20730002/2715065
Using native facebook SDK:
- download https://github.com/fbsamples/android-3.0-howtos/tree/master/PublishFeedHowTo
- download facebook SDK for android, and extract to your workspace folder of eclipse.
- reference facebook SDK for android in project->android->library of your "PublishFeedHowTo" project.
- modify in class "MainFragment.java":
.
private static final List<String> PERMISSIONS = Arrays.asList("publish_action");
to
private static final List<String> PERMISSIONS = Arrays.asList("publish_stream");
and look for:
Bundle postParams = new Bundle();
postParams.putString("name", "Facebook SDK for Android");
postParams.putString("caption", "Build great social apps and get more installs.");
postParams.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
postParams.putString("link", "https://developers.facebook.com/android");
postParams.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");
change to:
Bundle postParams = new Bundle();
postParams.putString("message", "my_message");
also in strings.xml you must put your app_id in the tag
<string name="app_id">app_id_number</string>
and that should do it.
来源:https://stackoverflow.com/questions/21507374/share-only-text-using-facebook-sdk