I'm currently using a JSONObjectRequest to get data from a server. I'm sending JSON data, but I expect a string response. Volley returns an error (a null error of course, so I have no idea what's going on). Is this because I'm using the wrong request? My code is:
JsonObjectRequest jsonObjReq = new JsonObjectRequest(
Request.Method.POST,
postURL.toString(),
getJson(),
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) { Log.d(TAG, response.toString()); }
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) { VolleyLog.d(TAG, "Error: " + error.getMessage()); Log.v(TAG, "Error: " + error.getCause()); }
}
);
My logcat contains the following data:
07-27 11:45:57.218 11309-12374/com.microsoft.quiztest D/libc: [NET] getaddrinfo+,hn 21(0x6670742e6d6963),sn(),family 0,flags 4
07-27 11:45:57.228 11309-12374/com.microsoft.quiztest D/libc: [NET] getaddrinfo-,err=8
07-27 11:45:57.228 11309-12374/com.microsoft.quiztest D/libc: [NET] getaddrinfo+,hn 21(0x6670742e6d6963),sn(),family 0,flags 1024
07-27 11:45:57.228 11309-12374/com.microsoft.quiztest D/libc: [NET] getaddrinfo-, 1
07-27 11:45:57.228 11309-12374/com.microsoft.quiztest D/libc: [NET] getaddrinfo_proxy+
07-27 11:45:57.228 11309-12374/com.microsoft.quiztest D/libc: [NET] getaddrinfo_proxy-, success
07-27 11:46:02.258 11309-12374/com.microsoft.quiztest D/libc: [NET] getaddrinfo+,hn 21(0x6670742e6d6963),sn(),family 0,flags 4
07-27 11:46:02.258 11309-12374/com.microsoft.quiztest D/libc: [NET] getaddrinfo-,err=8
07-27 11:46:02.258 11309-12374/com.microsoft.quiztest D/libc: [NET] getaddrinfo+,hn 21(0x6670742e6d6963),sn(),family 0,flags 1024
07-27 11:46:02.258 11309-12374/com.microsoft.quiztest D/libc: [NET] getaddrinfo-, 1
07-27 11:46:02.258 11309-12374/com.microsoft.quiztest D/libc: [NET] getaddrinfo_proxy+
07-27 11:46:02.288 11309-12374/com.microsoft.quiztest D/libc: [NET] getaddrinfo_proxy-, success
07-27 11:46:12.368 11309-11309/com.microsoft.quiztest V/DeviceForensics: Error: null
07-27 11:46:12.368 11309-11309/com.microsoft.quiztest W/System.err: com.android.volley.TimeoutError
07-27 11:46:12.368 11309-11309/com.microsoft.quiztest W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:141)
07-27 11:46:12.368 11309-11309/com.microsoft.quiztest W/System.err: at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:112)