1

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...???

Kara
  • 6,115
  • 16
  • 50
  • 57
Khawar Raza
  • 15,870
  • 24
  • 70
  • 127

1 Answers1

2
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);
Venky
  • 11,049
  • 5
  • 49
  • 66
  • Yes you are right. One more thing, on posting to wall, the request return something like an id. What's this...??? Actually I am new to android and trying to integrate facebook to some native app. – Khawar Raza Oct 04 '11 at 15:00
  • Er, did you just tell someone who was using the Graph API that it was 'old' and to use the REST API instead? That's the exact opposite of what they should be doing – Igy Oct 04 '11 at 15:04
  • He hasn't given us the error message, assuming one was returned from the API, but a POST request to `/{user-id}/feed` is the recommended way to update a user's status / post to their wall – Igy Oct 04 '11 at 15:14
  • Igy, what is the best way to do this? and Venky, what is ZValues? – Matt Oct 10 '11 at 12:19
  • @Matt ZValues is my class name, no need to worry about it.. Just use your Facebook's Object.. – Venky Oct 10 '11 at 12:28