I need to pass two parameters to server as cookie and I'm using volley library. I researched a lot and i couldn't find any solutions.
Below is my GET request to server.
StringRequest srequest = new StringRequest(method, URL, stringlistener, errorListener) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("Content-Type", "application/json");
return params;
}
};
ApplicationController.getInstance().addToRequestQueue(srequest);
And I've set CookieHandler also like below,
CookieStore cookieStore = new CustomCookieStore();
cookieStore.add(URI.create(URL), new HttpCookie(Constants.DEVICE_ID, a_id));
cookieStore.add(URI.create(URL), new HttpCookie(Constants.APP_VERSION_CODE, "100"));
CookieManager cookieManager = new CookieManager(cookieStore, CookiePolicy.ACCEPT_ALL);
CookieHandler.setDefault(cookieManager);
Without cookie, it is working perfectly. And we can't avoid cookies at this stage. So please help me on this.