如何使用Facebook的Andr​​oid SDK中整合Android应用程序发布在Facebook墙上留言如何使用、应用程序、墙上、留言

2023-09-04 10:40:21 作者:沧桑如夢初醒

我正在开发社交应用程序,这个应用程序集成,我使用Facebook的SDK中的Facebook SDK

i am developing social app this app integrate to facebook my app related message post to facebook wall i am using facebook sdk in facebook sdk

mPostButton.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                String message = "Post this to my wall";
                Bundle parameters = new Bundle();        
                parameters.putString("message", message);   
                mAsyncRunner.request("me/feed", parameters, "POST",  new SampleDialogListener());
            }
            });
     mPostButton.setVisibility(mFacebook.isSessionValid() ?
                View.VISIBLE :
                View.INVISIBLE);
    }



   public class SampleDialogListener extends BaseDialogListener implements RequestListener {

            public void onComplete(Bundle values) {
                final String postId = values.getString("post_id");
                if (postId != null) {
                    Log.d("Facebook-Example", "Dialog Success! post_id=" + postId);
                    mAsyncRunner.request(postId, new WallPostRequestListener());
                               } else {
                    Log.d("Facebook-Example", "No wall post made");
                }
            }
 public class WallPostRequestListener extends BaseRequestListener {

        public void onComplete(final String response, final Object state) {
            Log.d("Facebook-Example", "Got response: " + response);
            String message = "<empty>";
            try {
                JSONObject json = Util.parseJson(response);
                message = json.getString("message");
            } catch (JSONException e) {
                Log.w("Facebook-Example", "JSON Error in response");
            } catch (FacebookError e) {
                Log.w("Facebook-Example", "Facebook Error: " + e.getMessage());
            }
            final String text = "Your Wall Post: " + message;
            Example.this.runOnUiThread(new Runnable() {
                public void run() {
                    mText.setText(text);
                }
            });
        }

我用这code不工作发布消息我的内涵是用户登陆Facebook的我的字符串是开放刚刚发布的墙后

i am using this code is not working to post message my intension is userlogin facebook my string is open just publish wall post

推荐答案

由于我也是在这个阶段学习,可你为什么要使用示例对话框听者mAsyn.request告诉我(我/饲料,。 ....).....

As i am also a learner at this stage, Can you tell me why are you using sample dialog listener in mAsyn.request("me/feed",.....).....

什么是错误???

我想,如果你登录,只需拨打wallpostlistener在mAsync.request(ME /饲料,......,新WallPost ....)...这是我做我的应用程序。

I think, if you are logged in, just call wallpostlistener in mAsync.request("me/feed",...,new WallPost....)... this is what i do in my application.

 
精彩推荐