これは私のコードです
private void postToWall(String msg) {
Bundle parameters = new Bundle();
JSONObject attachment = new JSONObject();
String myjosn="{\"name\":\"LangGuage\",\"href\":\"http://www.hunkatech.com\",\"caption\":\" \",\"description\":\""+messageToPost+"\",\"media\":[{\"type\":\"image\",\"src\":\"http://hwsdemos.com/LangGuage/medal_1.png\",\"href\":\"http://www.hunkatech.com\"}],\"properties\":{\"Powered by:\":{\"text\":\"Hunka Technology Pvt. Ltd.\",\"href\":\"http://www.hunkatech.com\"}}}";
try {
parameters.putString(Facebook.TOKEN, facebook.getAccessToken());
parameters.putString("attachment",myjosn.toString());
String response = facebook.request("me/feed", parameters, "POST");
System.out.println("----responce" + response);
if (response.contains("Duplicate status message")) {
progressHandler.sendEmptyMessage(1);
resp = 1;
} else if (response == null || response.equals("")
|| response.equals("false") || response.contains("error")) {
Log.d("error", "error response");
} else {
progressHandler.sendEmptyMessage(0);
resp = 0;
}
} catch (Exception e) {
Log.e(TAG, "Posting fail");
e.printStackTrace();
}
}
Facebookの壁に画像付きのメッセージを投稿したい.私のjsonは正しいです.jsonフォーマッタエディタでチェックしました.次の例外がありました.解決方法の提案が必要です.
更新: 以下のコードの助けを借りて投稿された私のメッセージと画像:
parameters.putString("link", "http://www.hunkatech.com");
parameters.putString("picture", "http://hwsdemos.com/LangGuage/medal_1.png");
parameters.putString("name", "LangGuage");// name of link
parameters.putString("captions", "hello");
parameters.putString("message", "This is my message!!");
しかし、画像をテキストに残したいのですが、上記のコードはメッセージの下の画像として結果を返します。更新: json から何も投稿できません。誰もがこの問題を解決してください。画像と json をバインドする添付ファイルを送信したいのですが。