I have an android project and I need a framework to exchange information via webservice.
I have an android project and I need a framework to exchange information via webservice.
There is the Volley library maintained by Google that is intended to help implementations of HTTP communication.
Google provides a documentation page: link
Example usage:
public void initVolley(Context applicationContext) {
mRequestQueue = Volley.newRequestQueue(applicationContext);
}
public void doPost(JSONObject jsonObject) {
JsonObjectRequest request = new JsonObjectRequest(
Request.Method.POST,
URL,
jsonObject,
new Response.Listener() {
@Override
public void onResponse(JSONObject response) {
// Do something...
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Do something...
}
});
mRequestQueue.add(request);
}