share only text using facebook SDK

徘徊边缘 提交于 2019-12-04 19:32:02
Vivek Warde

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:

  1. download https://github.com/fbsamples/android-3.0-howtos/tree/master/PublishFeedHowTo
  2. download facebook SDK for android, and extract to your workspace folder of eclipse.
  3. reference facebook SDK for android in project->android->library of your "PublishFeedHowTo" project.
  4. 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!