i've searched this whole forum. The best match i could find was this one: Android - Upload photo to Facebook with Facebook Android SDK
Unfortunately this one only show how to upload picture from disk to facebook p开发者_运维问答rofile of the currently logon user.
I want to be able to upload photo to profile of friend. Till now I could only manage to do so by provide picture URL instead of uploading byte array from the disk.
Thanks,
piggy181
Here is the code i use, feel free to use it:
Bundle postdata = new Bundle();
postdata.putString("caption", msg);
postdata.putByteArray("photo", pic);
mAsyncRunner.request(usr+"/photos&access_token="+fb.getAccessToken(), postdata, "POST",new WallRequestListener(), null);
where "usr" is the user ID of your friend, caption is the message that will be posted with the picture, and photo well that's the picture :) which is sent as a byte array.
You can get the user's ID making a request to "me/friends".
I hope that helps.
精彩评论