我有以下代碼。Facebook API/Android:牆貼發佈與圖像附件不起作用
它的工作原理和職位的消息的一部分,但在附件部分一點兒也不工作。 我懷疑它與作爲一個字符串傳遞JSON有關。
的Facebook返回"{"id":"23522646737635675"}
。所以它不是一個錯誤。
Bundle params = new Bundle();
params.putString("message", message);
JSONObject attachment = new JSONObject();
attachment.put("href", URLEncoder.encode("http://a.espncdn.com/photo/2010/0523/pg2_a_cricket_576.jpg"));
attachment.put("name", "Cricket Fantasy");
attachment.put("caption", "New team");
attachment.put("description","Description about Application");
JSONObject media = new JSONObject();
media.put("type", "image");
media.put("src", URLEncoder.encode("http://a.espncdn.com/photo/2010/0523/pg2_a_cricket_576.jpg"));
media.put("href", URLEncoder.encode("http://a.espncdn.com/photo/2010/0523/pg2_a_cricket_576.jpg"));
attachment.put("media", media);
params.putString("attachement", attachment.toString());
String response = mFacebook.request("me/feed", params, "POST");