I want to do GET request with parameters using volley JsonArrayRequest. I have call getParam() method with parameters but its not calling.
JsonArrayRequest jreq = new JsonArrayRequest(Request.Method.GET,"http://api.openchargemap.io/v2/poi/",null,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
Log.d("TAG", "" + response.toString());
if(response.toString().length() > 1) {
parseJson(response.toString());
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("TAG",""+error.toString());
}
})
{
@Override
protected Map<String, String> getParams() {
Map<String,String> map = new HashMap<String,String>();
map.put("output","json");
map.put("countrycode","US");
map.put("latitude","32.57933044");
map.put("longitude","-110.8514633");
map.put("maxresults","100");
map.put("distance","10");
map.put("distanceunit","KM");
map.put("compact","true");
map.put("verbose","false");
return map;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(jreq);
I am not getting proper response because volley not calling getParam(). I have searched a lot on stack overflow but not get right answer and volley documentation is not good. Thats why I am puting my question here. Thanks.