如何使用 Facebook sdk 3.1 从 Android 应用程序在页面的时间线/墙上发布链接。
我尝试使用 pageid/feed 发布。但是即使它是由页面所有者发布的,它也会显示在标签“Recent Posts By Others on pagename”下。我需要将它显示在页面的墙上。用于在页面上发布的代码如下
Bundle postParams = new Bundle();
postParams.putString("message","message");
postParams.putString("name","name");
postParams.putString("link",link);
postParams.putString("picture",picture);
postParams.putString("display", "page");
Request.Callback callback = new Request.Callback() {
public void onCompleted(Response response) {
FacebookRequestError error = response.getError();
if (error != null) {
Log.e("FACEBOOK ERROR", ""+ error.getErrorMessage());
} else {
JSONObject graphResponse = response
.getGraphObject()
.getInnerJSONObject();
String postId = null;
try {
postId = graphResponse
.getString("id");
} catch (JSONException e) {
}
}
}
};
Request request = new Request(session,pageid+"/feed",postParams, HttpMethod.POST,callback);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();