Skip to content

Instantly share code, notes, and snippets.

@fizzysoftware
Created February 2, 2017 13:00
Show Gist options
  • Save fizzysoftware/a895bc2cbd1ad9a048277859f3f23963 to your computer and use it in GitHub Desktop.
Save fizzysoftware/a895bc2cbd1ad9a048277859f3f23963 to your computer and use it in GitHub Desktop.
String url = "https://app.interakt.co/api/ios/v1/projects/" + appId + "/faq_categories?access_token=" + appToken;
if (isNetworkAvailable()) {
JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONArray jsonArray = response.getJSONArray("categories");
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// TODO Auto-generated method stub
}
});
// Access the RequestQueue through your singleton class.
jsObjRequest.setRetryPolicy(new DefaultRetryPolicy(30000,
2,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
addToRequestQueue(jsObjRequest);
String url = "https://app.interakt.co/api/ios/v1/projects/" + appId + "/faq_categories?access_token=" + appToken;
if (isNetworkAvailable()) {
JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONArray jsonArray = response.getJSONArray("categories");
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// TODO Auto-generated method stub
}
});
// Access the RequestQueue through your singleton class.
jsObjRequest.setRetryPolicy(new DefaultRetryPolicy(30000,
2,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
addToRequestQueue(jsObjRequest);
public <T> void addToRequestQueue(Request<T> req) {
req.setTag("TAG");
getRequestQueue().add(req);
}
public RequestQueue getRequestQueue() {
ClientSSLSocketFactory clientSSLSocketFactory=new ClientSSLSocketFactory(30000);
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(getActivity());
}
return mRequestQueue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment