发布到特定的朋友的Facebook墙上
问题描述:
我要发布一条消息到一个特定的朋友的墙上。我曾试图与我/饲料,但它会显示我所有的朋友,但我需要发布一个消息,为特定的朋友。
I have to post a message to a specific friend's wall. I have tried with "me/feed" but it is displayed for all my friends, but I need to post a message for a specific friend.
答
您需要知道的朋友的ID,你可以看到我的方法下面这样做:
You need to know the friends id, you can see my method for doing it below:
public void postOnFriendsWall(String msg, String toID, String description) {
try {
if (isSession()) {
String response = mFacebook.request(toID);
Bundle parameters = new Bundle();
parameters.putString("message", msg);
parameters.putString("description", description);
response = mFacebook.request(toID+"/feed", parameters, "POST");
Log.d("FACEBOOK RESPONSE",response);
if (response == null || response.equals("") ||
response.equals("false")) {
Log.v("Error", "Blank response");
}
} else {
// no logged in, so relogin
Log.d(TAG, "sessionNOTValid, relogin");
mFacebook.authorize(this, PERMS, new LoginDialogListener());
}
} catch(Exception e) {
e.printStackTrace();
}
}