We can post to facebook friend's wall a text message, but how can we post an image, a picture to a friend's wall using Android Facebook SDK?
When I print out the wall variable it does show correctly USER_ID/feed. After posting the onComplete function of the RequestListener does get called, but there is nothing posted to the friends wall.
Here's example code we're trying to use:
Bundle params = new Bundle();
params.putString("method", "photos.upload");
params.putString("caption", photoCaption.getText().toString());
params.putByteArray("picture", data);
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
String wall = null;
wall = fArray.getJSONObject(pos).getString("id").toString() + "/feed";
mAsyncRunner.request(wall, params,"POST", new RequestListener(){
public void onComplete(String response, Object state) {
Log.d("text","facebook post complete");
}
public void onIOException(IOException e, Object state) {
Log.d("text","facebook post onIOException");
}
public void onFileNotFoundException(FileNotFoundException e, Object state) {
Log.d("text","facebook post onFileNotFoundException");
}
public void onMalformedURLException(MalformedURLException e, Object state) {
Log.d("text","facebook post onMalformedURLException");
}
public void onFacebookError(FacebookError e, Object state) {
Log.d("text","facebook post error");
}
}, null);
This is how I get the list of friends:
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
mAsyncRunner.request("me/friends", new RequestListener(){
public void onComplete(String response,Object state) {
try {
jObject = new JSONObject(response);
fArray = jObject.getJSONArray("data");