i am trying to implement login using volley like below:
public static JSONObject register(RequestQueue requestQueue, String url, HashMap<String, String> params) {
RequestFuture<JSONObject> requestFuture = RequestFuture.newFuture();
CustomRequest customRequest = new CustomRequest(Request.Method.POST,url,params,requestFuture,requestFuture);
JSONObject response = null;
requestQueue.add(customRequest);
try {
response = requestFuture.get(30000, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
L.m(e + "");
} catch (ExecutionException e) {
L.m(e + "");
} catch (TimeoutException e) {
L.m(e + "");
}
return response;
}
But whenever i send request i get null value as response. the web api call works, it creates the user but i can't get json result in case of an error like duplicate username etc.
parameters are :
url: http://localhost:13480/api/Account/Register Hashmap: (as json):
{ "Email": "admin@admin", "Password": "Password12!", "ConfirmPassword": "Password12!" }
and the custom request is here: Volley - POST/GET parameters So i can't figure out what is wrong. Any helps?