Recently I’ve been working on understanding how to post on the users Facebook wall from my app.
I have my access token and managed to work the SSO (the trick was to add the Android hash key) and the user is now loged on.
the problem is with the posting function.
public void updateStatus(String accessToken){
try {
Bundle bundle = new Bundle();
bundle.putString("message", "test update"); //'message' tells facebook that you're updating your status
bundle.putString(Facebook.TOKEN,accessToken);
//tells facebook that you're performing this action on the authenticated users wall, thus
//it becomes an update. POST tells that the method being used is POST
String response = facebook.request("me/feed",bundle,"POST");
Log.d("UPDATE RESPONSE",""+response);
} catch (MalformedURLException e) {
Log.e("MALFORMED URL",""+e.getMessage());
} catch (IOException e) {
Log.e("IOEX",""+e.getMessage());
}
}
I always catch an IOException and this is my stack trace, after I saw I need to pass on a byte array i changed the bundle extras to putByteArray("message", "test update".getBytes()) and also changed the token to bundle.putByteArray(Facebook.TOKEN,accessToken.getBytes()) but still I get the same stack trace…
any thoughts?
i solved the problem, it wat the lack of
onActivityResultand re-authentication the Facebook account with the proper function…