There seems to be an overwhelming amount of confusion to using Volley to do this. I have seen 20+ questions asking how to do this, but still I don't know why what I am doing is getting an empty response.
{"results":[]}
Here is the code I use to setup the JSONObjectRequest
String url = "http://bsg.redmatmediabizapp.com/admin/push/getPushNotifications.php";
JSONObject params = new JSONObject();
try {
params.put("AppVersion", "BSG");
params.put("userID", "2");
} catch (JSONException e) {
// TODO handle error
e.printStackTrace();
}
JsonObjectRequest request = new JsonObjectRequest(
Request.Method.POST, url, params,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
populateNavigationDrawer(response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//TODO Handle Error
Log.d(TAG, error.getMessage());
}
});
singleton.addToRequestQueue(request);
If I pass the same url and parameter key:value pairs to http://hurl.it I get a longer response, so I know the server is responding correctly.