다음 코드가 있습니다.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");