开发者

Post to specific friend's facebook wall

开发者 https://www.devze.com 2023-03-15 15:18 出处:网络
I have to post a message 开发者_C百科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.You need to

I have to post a message 开发者_C百科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.


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

精彩评论

暂无评论...
验证码 换一张
取 消