简体   繁体   中英

Android photo upload to facebook using graph api?

i use the facebook sdk to post message to wall on my facebook account from android application , its looking fine but when i use the following code of garph api to upload the image ,

            Bundle bundle = new Bundle();

            bundle.putString("message", "Viddygo Video Sharing");


            bundle.putString(Facebook.TOKEN,accessToken);

            bundle.putString("image", "http://simplestrength.com/wp-content/uploads/kanji_luck.png");



            String response = facebook.request("me/photos",bundle,"POST");

but i got the following error,

04-26 15:01:02.005: DEBUG/UPDATE RESPONSE(9405): { "error":{"type":"OAuthException","message":"(#324) Requires upload file"}}

just try this

bundle.putString("picture", "http://simplestrength.com/wp-content/uploads/kanji_luck.png");
String response = facebook.request("me/feed",bundle,"POST");

for post in album..

bundle.putByteArray("picture", byte);
String response = facebook.request("me/photos",bundle,"POST");

where byte = bytearray of image..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM