0

我想在墙上发一条消息,但不弹出对话框我试过了

parameters.putString("description", "test test test")
response = mFacebook.request("me/feed", parameters, "feed");

或者

response = mFacebook.request("me/feed", parameters, "stream.publish");

我得到一个错误

Got response: `{"error":{"message":"Unsupported method, feed","type":"Exception"}}`

下面发布的代码是如何在没有 dailog 的情况下在墙上发布消息以解决问题,您需要在创建 facebook 对象时添加权限,请参见下文

*最终字符串 FACEBOOK_PERMISSION = "publish_stream"; mPermissions = new String[]{FACEBOOK_PERMISSION};*

4

1 回答 1

1

使用此代码

 public void postOnWall(String msg) {
    Log.d("Tests", "Testing graph API wall post");
     try {
            String response = facebook.request("me");
            Bundle parameters = new Bundle();
            parameters.putString("message", msg);
            parameters.putString("description", "test test test");
            response = facebook.request("me/feed", parameters, 
                    "POST");
            Log.d("Tests", "got response: " + response);
            if (response == null || response.equals("") || 
                    response.equals("false")) {
               Log.v("Error", "Blank response");
            }

     } catch(Exception e) {
         e.printStackTrace();
     } 
}
于 2012-04-28T09:30:31.917 回答