I dont know why the getParams() is not working in my method?
The System.out.println works fine under getHeaders but not under getParams?
//---------------------------------------POST request with headers---------------------------------------
public void post(String url, final String param1, final String param2, String source) {
// Request a string response from the provided URL.
JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, url,
getReponse(source), createMyReqErrorListener()) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
HashMap<String, String> params = new HashMap<>();
params.put("loginAlias", "username");
params.put("loginPassword", "12345");
System.out.println("Params are: " + params.toString());
return params;
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
HashMap<String, String> headers = new HashMap<>();
headers.put(ACCEPT, ACCEPT_JSON); //Accepting JSON
headers.put(AUTH_ID, AUTH_ID_VALUE);
headers.put(PLATFORM, PLATFORM_VALUE);
headers.put(CID, "");
headers.put(DEVICE_TYPE_MOBILE, DEVICE_TYPE_MOBILE_VALUE);
System.out.println("Headers are: " + headers.toString());
return headers;
}
};
// Add the request to the RequestQueue.
queue.add(request);
}
I have followed all the Google Volley documentation and tried a couple options on SO but for some reason, this does not work?
Thanks