Facebook me / feed只能在开发者帐户上发布

时间:2014-08-21 07:01:14

标签: android facebook facebook-graph-api

我在这里遇到一个奇怪的情况。虽然发布到Facebook我希望我的应用程序绕过对话框要求写一些东西并显示我自己的自定义对话框。因此我必须使用" me / feed&# 34;。当我在开发者帐户中发布某些内容时,该应用程序正常工作。但是当我尝试在其他帐户中发帖时,它有时会返回任何内容或某些时候返回:

08-21 12:26:29.332: D/Facebook-Util(6796): POST URL: https://graph.facebook.com/me/feed
08-21 12:26:29.722: D/Tests(6796): got response: {"error":{"message":"(#200) The user hasn't authorized the application to perform this action","type":"OAuthException","code":200}}

我真的很困惑我在这里做了什么错。为什么邮件不是开发者帐户以外的帖子..?

这是我的相关代码:

if (facebook.isSessionValid()) {
                            facebook.authorize(BoonDriveActivity.this,
                                    new String[] { "publish_stream","publish_actions","manage_pages","status_update"},//This are the permissions
                                    new DialogListener() {

                                        @Override
                                        public void onCancel() {
                                            // Function to handle cancel event
                                        }

                                        @Override
                                        public void onComplete(Bundle values) {
                                            // Function to handle complete event
                                            // Edit Preferences and update facebook acess_token
                                            final SharedPreferences.Editor editor = mPrefs.edit();
                                            editor.putString("access_token",
                                                    facebook.getAccessToken());
                                            editor.putLong("access_expires",
                                                    facebook.getAccessExpires());
                                            editor.commit();
                                            LayoutInflater inflater=BoonDriveActivity.this.getLayoutInflater();
                                            View layout=inflater.inflate(R.layout.createsharedialoglinkedin,null);
                                            final AlertDialog d1 = new AlertDialog.Builder(BoonDriveActivity.this)
                                            // Your other options here ...
                                            .setView(layout)
                                            .create();//My custom dialog
                                            d1.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
                                            d1.show();
                                            lntxtfilename=(TextView)layout.findViewById(R.id.txtfilename);
                                            lnetmessage=(EditText)layout.findViewById(R.id.et_message);
                                            ln_btn_share=(Button)layout.findViewById(R.id.btn_share);
                                            ln_btn_showlink=(Button)layout.findViewById(R.id.btn_showlink);
                                            lnshowlink=(EditText)layout.findViewById(R.id.et_showlink);
                                            ln_btn_share.setText("SHARE ON FACEBOOK");
                                            ln_btn_showlink.setOnClickListener(new View.OnClickListener() {

                                                @Override
                                                public void onClick(View v) {
                                                    // TODO Auto-generated method stub
                                                    ln_btn_showlink.setVisibility(View.GONE);
                                                    lnshowlink.setVisibility(View.VISIBLE);
                                                    lnshowlink.setText(finallink);
                                                }
                                            });
                                            lntxtfilename.setText("Share"+" "+filename+" "+"with:");

                                            ln_btn_share.setOnClickListener(new View.OnClickListener() {

                                                @Override
                                                public void onClick(View v) {
                                                    // TODO Auto-generated method stub
                                                    //String s = ((GlobalFilename)BoonDriveActivity.this.getApplication()).getGlobalState();
                                                    if(lnetmessage.length()==0)
                                                    {
                                                        Toast.makeText(BoonDriveActivity.this,"Please enter message",Toast.LENGTH_LONG).show();
                                                    }
                                                    else{
                                                    String share1 = lnetmessage.getText().toString();
                                                    //String finalmsg=share1+"\n"+s;
                                                    System.out.println("This is the final msg linkedin--->"+ finallink);
                                                    //lnetmessage.setText(finalmsg);
                                                    //postToWall();
                                                    postToWall(share1,finallink);
                                                     d1.dismiss();
                                                    }
                                                }
                                            });



                                        }

                                        @Override
                                        public void onError(DialogError error) {
                                            // Function to handle error

                                        }

                                        @Override
                                        public void onFacebookError(FacebookError fberror) {
                                            // Function to handle Facebook errors

                                        }

                                    });
                        }



                    } 

我对此进行了大量搜索,但无法找到解决方案。请帮忙。

我使用以下方法发布到墙上:

@SuppressWarnings("deprecation")
    public void postToWall(String message,String link){

        Bundle parameters = new Bundle();

                parameters.putString("message", message+link);
               // parameters.putString("link",link);
               /* parameters.putString("description", "topic share");
                parameters.putString("picture", link);*/
                try {
                     String response = facebook.request("me");
                    facebook.request("me");
             response = facebook.request("me/feed", parameters, "POST");
            Log.d("Tests", "got response: " + response);
            if (response == null || response.equals("") ||
                    response.equals("false")) {
                showToast("Blank response.");
            }
            else {
                showToast("Message posted to your facebook wall!");
            }

        } catch (Exception e) {
            showToast("Failed to post to wall!");
            e.printStackTrace();

        }
    }

2 个答案:

答案 0 :(得分:2)

如果您的应用尚未经过审核,则此应用的管理员和开发者之外的其他任何用户都无法提供相应的权限。

这在文档中描述:

引用:

  

如果您是应用的开发者并且是唯一使用它的人,那么您的应用不需要经过审核。由于您是开发人员,因此应该可以使用所有应用功能。您仍然需要将您的应用程序从开发者模式中删除,但是您应该能够在不经过审核的情况下执行此操作。

而且,BTW,没有status_update权限......

答案 1 :(得分:0)

您好有可能在Facebook上接受它们后授予权限。首先从Facebook中删除应用程序权限,然后再试一次。

相关问题