I'm trying to change json parsing from HTTP connections to Volley, but I have problem with connections where I have to add parameters to connection. I know that normal connection works well and it connects with PHP file, but it says that I'm missing something which means that parameter is not sent or I have to change the way PHP read it.
Android code for params looks like this :
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.GET,
url_get_comments, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
....
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG, "Error: " + error.getMessage());
pDialog.hide();
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("tag", tag + "");
return params;
}
};
AppController.getInstance().addToRequestQueue(jsonObjReq, tag_json_obj);
PHP code for taking params looks like this :
if(isset($_GET['tag'])) {
The problem is that PHP doesn't see tag parameter.