简体   繁体   English

android facebook sdk 3.14.1发布在朋友的墙上

[英]android facebook sdk 3.14.1 posting on friend's wall

I used facebook-sdk 3.14.1 for android to post some content on friend's wall. 我使用Facebook-sdk 3.14.1 for android在朋友的墙上张贴了一些内容。 When i try to post on my wall using the WebDialog.FeedDialogBuilder class, it works perfectlly. 当我尝试使用WebDialog.FeedDialogBu​​ilder类在墙上张贴文章时,它可以完美地工作。 But when i want to post something on friend's wall, using WebDialog.FeedDialogBuilder(context, session) and calling the method setTo(friendID) on it, it gives me the next error: "This dialog has been passed a bad parameter." 但是,当我想在朋友的墙上张贴一些东西时,使用WebDialog.FeedDialogBu​​ilder(context,session)并在其上调用方法setTo(friendID),它给我下一个错误:“此对话框已传递了错误的参数。”

Here is my code: 这是我的代码:

public static void postToFriendWall(Activity activity, String message, String facebookID)
{
    Session session=Session.getActiveSession();
    if(session!=null)
    {
        Bundle _postParameter=new Bundle();
        _postParameter.putString("to", facebookID);
        _postParameter.putString("name", message);
        _postParameter.putString("link", "http://www.link.com");
        _postParameter.putString("picture", "http://www.link.com/images/preview.png");
        _postParameter.putString("description", activity.getResources().getString(R.string.facebook_share));

        WebDialog dialog=(new WebDialog.FeedDialogBuilder(activity, session, _postParameter)).build();
        dialog.show();
    }
}

I tried to capture the url which has been generated and loaded in the webview, and paste in a normal browser, it gives me the same error message, but when I remove the "to=friendID" from the URL, it perfectlly works but the post is in my own wall. 我试图捕获已生成并加载到webview中的url,并粘贴到普通浏览器中,它会给我同样的错误消息,但是当我从URL中删除“ to = friendID”时,它可以正常工作,但是帖子在我自己的墙上。 I was also surprised seeing it works with the iOS version for the facebook-sdk. 我也很惊讶地看到它与facebook-sdk的iOS版本一起使用。 Can anyone help me for this? 有人可以帮我吗? Thanks. 谢谢。

您应该使用“共享”按钮: https : //developers.facebook.com/docs/android/share#linkapi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM