-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应用程序使用这个方法。 –