Please, does Volley automatically add my GET params to the URL? For me it\'s not working so and also when looking into sources, I just cant find any call of the getParams me
As for Itai Hanski answer, this is one example to implement that:
for(String key: params.keySet()) {
url += "&"+key+"="+params.get(key);
}
getParams()
is not called on the GET method, so it seems you'll have to add it to the URL before you send the request.
Check out the JavaDoc:
Returns a Map of parameters to be used for a POST or PUT request.
Can throw {@link AuthFailureError} as authentication may be required to provide these values.
Note that you can directly override {@link #getBody()} for custom data.
@throws AuthFailureError in the event of auth failure
Try this,
public class LoginRequest extends Request<String> {
// ... other methods go here
private Map<String, String> mParams;
public LoginRequest(String param1, String param2, Listener<String> listener, ErrorListener errorListener) {
super(Method.POST, "http://test.url", errorListener);
mListener = listener;
mParams.put("paramOne", param1);
mParams.put("paramTwo", param2);
}
@Override
public Map<String, String> getParams() {
return mParams;
}
}
See this example also,
https://github.com/evancharlton/folly/