0
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 有点陌生。我已经成功地在自己的墙上发帖,我希望通过我的 android 移动应用程序在朋友的墙上发帖。上面的示例代码最适合我的要求。

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

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

4

1 回答 1

0

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

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

问候,S@ki ;)

于 2014-05-23T07:10:40.177 回答