I have been trying to post my Credentials class from Android to C#.Net web server.
Volley Post method accepts params like:
@Override
protected Map<String, String> getParams() throws AuthFailureError {
return parameters;
}
Return type of getParams() is Map<String, String> but I need Map<String, Object> to send my class to web server. I even tried to convert my class into json string like:
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("credentials", new Gson().toJson(mCredentials, Credentials.class));
return parameters;
}
But it does not work. Server returns "Invalid Parameter" error which is thrown when "credentials" parameter is null.
There is nothing wrong on server side because I was able to do it with AsyncTask. I decided to turn my requests into Volley and I got stuck on this problem.
Anybody has a solution?