发布到特定朋友的Facebook墙

Ven*_*ana 0 android facebook-graph-api

我必须向特定朋友的墙发布消息.我尝试过"me/feed",但它会显示给所有朋友,但我需要为特定朋友发布消息.

Ken*_*nny 7

您需要知道朋友ID,您可以在下面看到我的方法:

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();
    }
}
Run Code Online (Sandbox Code Playgroud)