我有我的Android應用程序,允許用戶在Facebook上分享一些文本的有趣片段。用戶的牆壁同時發佈到Facebook粉絲頁面和用戶的牆上。 Android
共享工作正常,並使用本教程實現: http://www.integratingstuff.com/2010/10/14/integrating-facebook-into-an-android-application/
我也有我的應用程序的Facebook粉絲頁面,我想,以鞏固該網頁上的所有此類個股。 因此,當一些用戶在他們的牆上分享文本時,程序也會在Facebook粉絲頁面上發佈此消息,以便如果有人對討論感興趣,他們可能會喜歡粉絲頁面並訂閱其他用戶發表的所有評論。
我的問題是,我可以在用戶的牆上發佈或在粉絲頁上發佈。 我怎樣才能同時做到這一點?
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?