Android:将图片上传到Facebook上的特定相册

时间:2012-07-30 06:30:55

标签: android facebook facebook-graph-api

我正在查看facebook SDK for Android中的示例,我无法弄清楚如何将图像上传到用户的特定相册。我已经完成了身份验证,因此用户可以根据需要上传到私人相册。这是我的上传代码:

public void uploadFacebookPhoto(String description)
{
    Bundle params = new Bundle();

    params.putString("method", "photos.upload");
    params.putByteArray("picture", picData);
    params.putString("description", description);

    params.putString(SOME_IDENTIFIER, MY_ALBUM); 

    AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(mFacebook);
    mAsyncRunner.request(null, params, "POST", new SampleUploadListener(), null);
}

1 个答案:

答案 0 :(得分:1)

试试这个代码段:

Bundle params = new Bundle();
params.putByteArray("source", imageBytes);
params.putString("message", "A wall picture");
facebook.request("ALBUM_ID/photos", params, "POST");

ALBUM_ID - 是您需要发布图片的相册ID。

有关进一步参考,请查看Facebook Post