-2
在我的項目中,我想發送一個請求與地圖內的排球地圖。
但我收到錯誤,406錯誤。排球內地圖地圖JSON請求
這裏是我的要求:
StringRequest myReq = new StringRequest(Method.POST, METHOD_ACCOUNT_LOGIN,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
JSONObject veri_json;
try {
veri_json = new JSONObject(response);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
System.out.println(error.getMessage());
}
}) {
protected Map<String, String> getParams()
throws com.android.volley.AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("user", generalParams);
return params;
};
};
App.getInstance().addToRequestQueue(myReq);
}
,但我想這裏面的代碼導入
params.put("user",generalParams)
這些行:
generalParams.put("name",notificationName);
generalParams.put("notificationId", notificationID);
generalParams.put("phoneNumber", phoneNumber);
generalParams.put("regionType", regionType);
generalParams.put("countryCode", countryCode);
generalParams.put("platform", platform);
這裏是我想送什麼:
"user":{
"name":"John",
"notificationId":"id",
"phoneNumber":"number",
"regionType":"en",
"countryCode": "+10",
"platform":」ios」
}
但是,我不知道如何處理這個問題。
感謝您的回答。但我真的是新的這些請求。那麼我可以在哪裏準確寫出這些代碼呢?這是在@Override受保護的Map getParams()? –
啊,是的。對於那個很抱歉。 –
這仍然是BasicNetwork.performRequest:意外的響應代碼406 :(實際上這個服務器接受這個,因爲ios應用程序使用這個方法。 –