how to add headers google volley?

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

how to add headers google volley?

Postby scherman » Mon Oct 07, 2013 3:34 am

well, i am new in this forum, please if you could help me in this. i searched but i could not find how to add headers to a volley request. i have this code and i want to add the accept-encoding:gzip and the api key. i would appreciate your help. here is the code:

type = "cafe";
url = "https://maps.googleapis.com/maps/api/place/search/json?location=" + Global.location + "&radius=500&types=" + type + "&sensor=true&key="+placesKey;


RequestQueue rq = Volley.newRequestQueue(context);

JsonObjectRequest jsonRequest = new JsonObjectRequest(Request.Method.GET, url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {

List<Review> reviews = new ArrayList<Review>();
reviews = Parsing.ParseReviews(response);
}
}, new Response.ErrorListener() {

@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(context, error.toString(), Toast.LENGTH_SHORT).show();

}
});

rq.add(jsonRequest);
scherman
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Jun 09, 2013 8:58 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: Google [Bot] and 4 guests