【问题标题】:How to post message on facebook friends wall in android [duplicate]如何在android中的Facebook朋友墙上发布消息[重复]
【发布时间】:2013-02-12 13:44:07
【问题描述】:

我正在使用以下代码通过我的 android 应用程序在 facebook 朋友墙上发布消息。它在 2013 年 2 月 6 日之前工作。但从 2013 年 2 月 7 日开始,它给了我一个错误,得到了回应:

{"error":{"message":"(#200) Feed story publishing to other users is disabled for this application","type":"OAuthException","code":200}}

我的代码是,

public void postToWall(String message){
    Bundle parameters = new Bundle();
    parameters.putString("message", message);  
    parameters.putString("description", "topic share"); 
    try {
        facebook.request("me");
        //              String response = facebook.request("Mrunal.Junghare/feed", parameters, "POST");
        String response = facebook.request(""+frienduser_id+""+"/feed", parameters, "POST");
        //          System.out.println("name111111========"+""+ListActivity.user_name+"/feed");
        Log.d("Tests", "got response: " + response);
        if (response == null || response.equals("") ||
                response.equals("false")) {
            Toast.makeText(getApplicationContext(), "Blank response.", Toast.LENGTH_SHORT).show();  
        }
        else {

            Toast.makeText(getApplicationContext(),"Message posted to facebook wall!",Toast.LENGTH_SHORT).show();
        }
        finish();
    } catch (Exception e) {

        Toast.makeText(getApplicationContext(),"Failed to post to wall!", Toast.LENGTH_SHORT).show();
        e.printStackTrace();
        finish();
    }
}

如何解决 2013 年 2 月重大变更的问题..

【问题讨论】:

标签: android facebook


【解决方案1】:

试试这个,

    private void postToFacebook(String review) {
    mProgress.setMessage("Posting ...");
    mProgress.show();

    AsyncFacebookRunner mAsyncFbRunner = new AsyncFacebookRunner(mFacebook);

    Bundle params = new Bundle();

    params.putString("message", review);
    params.putString("name", "Message");


    mAsyncFbRunner.request("me/feed", params, "POST",
            new WallPostListener());
}

private final class WallPostListener extends BaseRequestListener {
    public void onComplete(final String response) {
        mRunOnUi.post(new Runnable() {
            @Override
            public void run() {
                mProgress.cancel();

                Toast.makeText(Mainactivity.this, "Posted to Facebook",
                        Toast.LENGTH_SHORT).show();
            }
        });

    }
}

这里有示例代码使用这个Click here

【讨论】:

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