This wants to send JsonObject in key Json. So please tell how to send it using volley. json={"product":"magie"}
How to send this data in Volley, I have add the asyncTask code below for hit api with that type of data.
enter code here
protected void onPreExecute() {
if (progress)
GlobalAlerts.showProgressDialog(context);
}
@Override
protected String doInBackground(String... params) {
String resp = null;
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("product","magie");
} catch (JSONException e) {
e.printStackTrace();
}
String data = "json=" + jsonObject.toString();
String url ="http://anc.php";
resp = new JsonCall().executeHttpPostRequest(url, data);
return resp;
}
protected void onPostExecute(String resp) {
if (progress)
GlobalAlerts.hideProgressDialog();
if (resp != null) {
callback.onTaskComplete(resp);
} else {
GlobalAlerts.singleAlert((Activity) context, context.getString(R.string.warning), "Error", false);
}
}