【问题标题】:Facebook android post on the wall Permission errorFacebook android 贴在墙上权限错误
【发布时间】:2012-04-28 09:13:46
【问题描述】:

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

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};*

【问题讨论】:

    标签: android facebook


    【解决方案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();
         } 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多