【问题标题】:How to post message on FaceBook wall?如何在 Facebook 墙上发布消息?
【发布时间】:2011-11-17 11:17:54
【问题描述】:

我想在 facebook 墙上发布一条消息,我在我的项目中集成了 facebook sdk,我是这样编码的,但是 facebook 墙上没有消息显示,但是信息来自我的应用程序... 这是我用来发帖的,

public void updateStatus(String accessToken, String message){  

       System.out.println("mes is "+message);           
       Bundle bundle = new Bundle();     
       bundle.putString("message", message);                    
       facebook.dialog(this, "stream.publish", bundle, this);

}

【问题讨论】:

    标签: android facebook facebook-wall


    【解决方案1】:

    我遇到了同样的问题。我在facebook.dialog() 方法的message 字段的Facebook documentation 中搜索到以下内容:

    消息:“此字段将在 2011 年 7 月 12 日被忽略 用于预填充用户将输入的文本字段的消息。为了符合 Facebook 平台政策,您的应用程序只能在用户手动生成的情况下设置此字段工作流中较早的内容。大多数应用程序不应设置此内容。"

    您需要改用以下内容:

    Facebook.request("me/feed", bundle, "POST");
    

    【讨论】:

    • 我改变了你所说的,但我没有在墙上得到任何东西
    • 你在 logcat 中收到了什么?
    • 你能分享你在facebook.authorize中使用的权限吗?另外,您是否在设备/模拟器上安装了 Facebook 应用程序。如果是,请尝试将其删除并重新测试。
    【解决方案2】:
       public void showPostDailog ( String message ) {
            ProgressDialog authDialog = ProgressDialog.show ( SubmitComplaintActivity.this , "Please wait" ,
                  "Posting Message"   , true , // indeterminate
                    false ) ;
    
            Bundle parameters = new Bundle ( ) ;
    
            parameters.putString ( "link" , reult_complaint_url ) ;
            try {
                String response = mFacebook.request ( "me/feed" , parameters , "POST" ) ;
                System.out.println ( response ) ;
                isCompleteFacbook = true ;
            } catch ( IOException e ) {
                e.printStackTrace ( ) ;
            }
            if ( authDialog != null && authDialog.isShowing ( ) ) {
                authDialog.dismiss ( ) ;
                authDialog.hide ( ) ;
            }
        }
    

    【讨论】:

      【解决方案3】:

      如果您使用的是 Android Facebook SDK,则代码位于 FacebookConnector.java 类中。 postmessageinThread() 函数。

      if ((fbconnector.getFacebook().isSessionValid())    {
          loginid=FacebookConnector.response;
          System.out.println("FB login ID is"+loginid);
          postMessageInThread(); //Replace this with another activity
          //String url="https://graph.facebook.com/me/friends?access_token=TOKEN";
      } else  {
      SessionEvents.AuthListener listener = new SessionEvents.AuthListener() {
          public void onAuthSucceed() 
          {
             System.out.println("onAuthSucceed");
             postMessageInThread();
          }
          public void onAuthFail(String error) 
          {
          }
      };
      SessionEvents.addAuthListener(listener);            System.out.println("Login to Facebook");
              fbconnector.login();
      
          }
      }
      private String getFacebookMsg() {
          System.out.println("Login value from getFacenookMSg"+loginid);      
          return "test";
      }
      

      【讨论】:

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