【问题标题】:Post to specific friend's facebook wall发布到特定朋友的 Facebook 墙
【发布时间】:2011-06-25 18:34:50
【问题描述】:

我必须在特定朋友的墙上发布消息。我已经尝试过使用“me/feed”,但它会显示给我所有的朋友,但我需要为特定的朋友发布消息。

【问题讨论】:

    标签: android facebook-graph-api


    【解决方案1】:

    你需要知道朋友的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();
        }
    }
    

    【讨论】:

    • 如何使用graph api中的批量请求向多个朋友墙发帖
    • parameters.putString("message", msg);是否仍然适用于新应用
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多