Bundle params = new Bundle();
params.putString("method", "photos.upload");
params.putString("message", "Test Photo");
params.putByteArray("picture", data);
mAsyncRunner.request(null, params, "me/feed",
new SampleUploadListener(), null);
i tried this also
mAsyncRunner.request(null, params, "POST",
new SampleUploadListener(), null);
i am using this code to upload photo to facebook. but the photo comes in album 'app_name photos'. the comment is also missing. is there any way to upload photo to wall with comment ?
UPDATE : comments are coming when i added.
params.putString("caption", "Test Photo 2");
EDIT:
params.putString(Facebook.TOKEN, token);
params.putString("message", "graph api");
mAsyncRunner.request("me/feed", params,"POST", new SampleUploadListener(),null);
this is posting the message to wall. but if add a picture, it is not coming on the wall.
params.putByteArray("picture", data);
Not too sure about the me/feed
path, but this worked for album:
params.putByteArray("source", data);
Instead of picture
and without specifying the method
The photos that you are uploading through your facebook application whose secret Id you will give in your android application. If fb application on site is not approved by facebook then at this juncture you have to approved the images that gets uploaded to your photos fb account section.
Please try this for upload photo on facebook wall post.
String IMAGE_PATH_FROM_SERVER = "http://................";
Bundle b = new Bundle();
String attachment = "{\"media\":[{\"type\":\"image\",\"src\":\"" + IMAGE_PATH_FROM_SERVER + "\",\"href\":\""+IMAGE_PATH_FROM_SERVER+"\"}]}";
b.putString("attachment", attachment);
sFacebook.dialog(context, "stream.publish", b, new SampleDialogListener());
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.