Venkat Papana
Venkat Papana

Reputation: 4947

Post to specific friend's facebook wall

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.

Upvotes: 0

Views: 2147

Answers (1)

Kenny
Kenny

Reputation: 5542

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();
    }
}

Upvotes: 7

Related Questions