Facebook上的android帖子权限错误

时间:2012-04-28 09:13:46

标签: android facebook

我想在墙上发布消息,而不会弹出对话框 我试过了

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对象时添加预设 见下文

* final String FACEBOOK_PERMISSION =“publish_stream”; mPermissions = new String [] {FACEBOOK_PERMISSION}; *

1 个答案:

答案 0 :(得分: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();
     } 
}