Facebook post to wall give exception

2019-07-30 06:49发布

I want to post text message to my facebook wall. My example code is:

public void postOnMyFacebookWall(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();
     }
}

I have called authorize function and got access_token before making call to this function. But got the following type of error:

key message expected byte[] but value was a java.lang.String. The default value <null> was returned.

And when I see on my facebook wall, the post is visible there too... Any idea...???

1条回答
We Are One
2楼-- · 2019-07-30 07:38
key message expected byte[] but value was a java.lang.String. The default value <null> was returned.

This Error will not affect your Post on wall, But update your code , that's old method for Post in wall,Try with this code for Post in Facebook Wall :

Bundle parameters = new Bundle();
parameters.putString("message", "Text is lame. Listen up:");
parameters.putString("method", "stream.publish");
String  response = ZValues.authenticatedFacebook.request(parameters);       
Log.v("response", response);
查看更多
登录 后发表回答