我有以下代码。
它可以工作并发布消息部分,但附件部分不起作用。我怀疑这与将 JSON 作为字符串传递有关。
脸书回归"{"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");