I am trying to use the Android Facebook sdk to make a post on the user's friend's wall. I have successfully posted to the user's own news feed using similar calls. With my current code, the post to a friend works without a hitch, except that the message is blank. None of the attachments seem to work. It shows up as a completely blank post on the friend's wall.
This is the code I am using:
private void publishChallengeToFriend() {
String description =
"I challenge you to " + m_challenge.getTitle() + "!" +
" I finished this challenge with a score of " + getScore() + "."
+ " Can you beat that?";
Bundle params = new Bundle();
params.putString(Facebook.TOKEN, m_facebook.getAccessToken());
params.putString("message", "");
params.putString("name", "You have been challenged!");
params.putString("caption", "Mobile Challenges");
params.putString("description", description);
try{
m_facebook.request(getFriendId() + "/feed",params, "POST");
}
catch (Exception e){
Log.d("TAG", "Facebook Error: " + e.getLocalizedMessage());
}
}
I have already authorized the user, and I know that works because I can post to the user's own feed. I am aware of the github issue #166 at https://github.com/facebook/facebook-android-sdk/issues/166. I have tried using putByteArray() for each of the attachments by calling getBytes() on each string I would like to transmit. This still shows up as a blank post on the friend's wall.
I am open to using any method of posting on the friend's wall, it doesn't have to be a facebook request. I have also used asyncfacebookrunner.request() and have had the same problem. Ideally, I would like to use a dialog to show this, but I have no idea how to use the dialog() function for friend posts. I use that for status updates without a hitch, however.
Thank you!