Volley not calling getParams() for standard POST request

it happened because Volley params cache.

clean it like this

requestQueue.getCache().clear();

hope it's useful!😃


I solved my issue by simply removing Content-Type from header :)


The third parameter should be a JSONObject you do not need the getParams() method just pass them into the request.

 JsonObjectRequest jsonObjReq = new JsonObjectRequest(
            method,
            url,
            jsonObjParams,    // <<< HERE
            responseListener,
            errorListener);

Using StringRequest in place of JsonObjectRequest

StringRequest sr = new StringRequest(Request.Method.POST, url , new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {
            Log.d(TAG, response.toString());
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            VolleyLog.d(TAG, "Error: " + error.getMessage());
            Log.d(TAG, ""+error.getMessage()+","+error.toString());
        }
    }){
        @Override
        protected Map<String,String> getParams(){
            Map<String, String> params = new HashMap<String, String>();
            params.put("id", "28");
            params.put("value", "1");

            return params;
        }

        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            Map<String,String> headers = new HashMap<String, String>();
            headers.put("Content-Type","application/x-www-form-urlencoded");
            headers.put("abc", "value");
            return headers;
        }
    };

        AppController.getInstance().addToRequestQueue(sr);