In my project, I want to send a request with Volley map inside map.
But I'm getting errors, 406 errors.
Here is my request:
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);
}
but I want to import inside this code
params.put("user",generalParams)
these lines:
generalParams.put("name",notificationName);
generalParams.put("notificationId", notificationID);
generalParams.put("phoneNumber", phoneNumber);
generalParams.put("regionType", regionType);
generalParams.put("countryCode", countryCode);
generalParams.put("platform", platform);
here is what I want to send:
"user":{
"name":"John",
"notificationId":"id",
"phoneNumber":"number",
"regionType":"en",
"countryCode": "+10",
"platform":”ios”
}
However, I don't know how to handle this.