开发者

android with facebook SDK: upload picture to your friend's profile

开发者 https://www.devze.com 2023-02-14 13:51 出处:网络
i\'ve searched this whole forum. The best match i could find was this one: Android - Upload photo to Facebook with Facebook Android SDK

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消