【问题标题】:How do I post some message on a friend's wall using the Android Facebook SDK?如何使用 Android Facebook SDK 在朋友的墙上发布消息?
【发布时间】:2014-05-23 06:51:49
【问题描述】:
protected void postToWall(String userID){
try {
    if (isSession()) {
        String response = mFacebook.request((userID == null) ? "me" : userID);

        Bundle params = new Bundle();
        params.putString("message", "put message here");
        params.putString("link", "some link");    
        params.putString("caption", "{*actor*} just posted this!");
        params.putString("description", "description of my link.  Click the link to find out more.");
        params.putString("name", "Name of this link!");
        params.putString("picture", "some pciture");

        response = mFacebook.request(((userID == null) ? "me" : userID) + "/feed", params, "POST");       

        Log.d("Tests",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();}

我对 Android 有点陌生。我已经成功地在自己的墙上发帖,我希望通过我的安卓移动应用在朋友的墙上发帖。上面的示例代码最适合我的要求。

我不明白从哪里得到userID(必须作为字符串传递给这个方法)。请指导我并为我提供一些可以给我用户朋友 ID 的东西。

这是我找到此代码的link。我的要求完全一样。

【问题讨论】:

  • 我很确定你不能在朋友墙上发帖

标签: android facebook facebook-graph-api facebook-friends


【解决方案1】:

我认为您需要请求“publish_actions”……。 请参阅以下链接::

https://developers.facebook.com/docs/facebook-login/permissions/v2.0

问候, S@ki ;)

【讨论】:

    猜你喜欢
    • 2012-04-29
    • 2012-04-27
    • 1970-01-01
    • 1970-01-01
    • 2011-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多