【发布时间】:2012-05-02 11:03:36
【问题描述】:
我的 android 应用程序允许用户在 Facebook 上分享一些有趣的文本片段。
在用户的墙上分享可以正常工作,并使用本教程实现: http://www.integratingstuff.com/2010/10/14/integrating-facebook-into-an-android-application/
我还有一个我的应用程序的 facebook 粉丝页面,我想在该页面上合并所有此类个人共享。 这样当一些用户在他们的墙上分享文本时,程序也会在 facebook 粉丝页面上发布,这样如果有人对讨论感兴趣,他们可以喜欢粉丝页面并订阅其他用户制作的所有 cmets。
我的问题是我可以在用户的墙上发布或在粉丝页面上发布。 我怎样才能同时做到这两点?
public void postToWall(){
Bundle parameters = new Bundle();
parameters.putString("message", this.messageToPost);
parameters.putString("description", this.messageDesc);
parameters.putString("link", this.messageLink);
// parameters.putString("target_id", FAN_PAGE_ID);
try {
facebook.request("me");
// String response = facebook.request("me/feed", parameters, "POST");
String response = facebook.request(FAN_PAGE_ID+"/feed", parameters, "POST");
Log.d("Tests", "got response: " + response);
if (response == null || response.equals("") ||
response.equals("false")) {
showToast("Blank response.");
}
else {
showToast("Message posted to your facebook wall!");
}
finish();
} catch (Exception e) {
showToast("Failed to post to wall!");
e.printStackTrace();
finish();
}
}
此行发布到用户的墙
String response = facebook.request("me/feed", parameters, "POST");
这个是粉丝页面
String response = facebook.request(FAN_PAGE_ID+"/feed", parameters, "POST");
我已为我的应用设置了使用此帖子在粉丝页面上发布的权限 Simple example to post to a Facebook fan page via PHP?
【问题讨论】:
标签: facebook facebook-android-sdk