问题
I want to post a picture to the wall, just like what I can do from the facebook web page.
I've tried these two ways, but both not what I want.
- [ http://facebook.stackoverflow.com/questions/5168145/android-post-picture-to-facebook-wall ] This one just upload pictures to the photo gallery, there will be a message on the wall, but it's not actually a post. Multiple pictures will be put in the same message.
- [ Android how to post picture to friend's wall with facebook android sdk ] This one post to the wall, with link to the picture. But it looks like sharing a link, the picture is so small.
Is it possible to make a wall post with a picture (a file from the phone, not URL)?
Which looks like I posted from the "Upload Photo" on facebook website.
http://i.stack.imgur.com/o16Hn.png (sorry I can't post image)
Thanks!
回答1:
The accepted answer in the 1st thread is correct, with just one change, you see when you upload a picture in facebook, like in the screen capture you added, you post it to a specific album titled "Wall Photos".
In that answer they used me/photos, and that will create an album for the app (if one isn't already existing) and post the image there.
I think that this should work:
Bundle params = new Bundle();
params.putByteArray("source", imageBytes);
params.putString("message", "A wall picture");
facebook.request("me/feed", params, "POST");
(you can obviously use the async runner)
If that does not work, then you'll have to get the "wall photos" album id of the logged in user first and then do something like:
Bundle params = new Bundle();
params.putByteArray("source", imageBytes);
params.putString("message", "A wall picture");
facebook.request("ALBUM_ID/photos", params, "POST");
来源:https://stackoverflow.com/questions/10160449/post-a-picture-to-the-wall-from-android