从Android上传带有facebook api的照片,看起来成功了,但我的facebook没有任何变化



首先,感谢您的阅读。这是我的代码

public void uploadPicture(String token, String message, File imageFile) throws ParseException, IOException {
HttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
HttpPost httppost = new HttpPost("https://graph.facebook.com/me/photos");
MultipartEntity mpEntity = new MultipartEntity();
mpEntity.addPart(Facebook.TOKEN, new StringBody(token));
mpEntity.addPart("source", new FileBody(imageFile, "image/png"));
mpEntity.addPart("message", new StringBody(message));
httppost.setEntity(mpEntity);
// DEBUG
Log.v(CLASS_NAME, "executing request " + httppost.getRequestLine());
HttpResponse response = httpclient.execute(httppost);
HttpEntity resEntity = response.getEntity();
// DEBUG
Log.v(CLASS_NAME, "getStatusLine " + response.getStatusLine());
if (resEntity != null) {
Log.v(CLASS_NAME, EntityUtils.toString(resEntity));
} // end if
if (resEntity != null) {
resEntity.consumeContent();
} // end if
httpclient.getConnectionManager().shutdown();
}

DDMS显示响应:

executing request POST https://graph.facebook.com/me/photos HTTP/1.1
getStatusLine HTTP/1.1 200 OK
{"id":"113353398770816″}

所以,它应该完成完成。但是我的facebook没有任何变化。有人能告诉我我做错了什么吗?

你可能要等一会儿。我看到上传的图片过了一段时间才出现。

最新更新