Skip to content
This repository has been archived by the owner on Feb 26, 2018. It is now read-only.

Request Identity onErrorResponse Section #160

Open
comeback4u opened this issue Jul 25, 2016 · 0 comments
Open

Request Identity onErrorResponse Section #160

comeback4u opened this issue Jul 25, 2016 · 0 comments

Comments

@comeback4u
Copy link

comeback4u commented Jul 25, 2016

public void getTestDats(String unique_id) {
    final String tag = "testList";
    String url = Constants.BASE_URL + "test_module.php";
    Map<String, String> params = new HashMap<String, String>();
    params.put("user_id", SharedPreferenceUtil.getString(Constants.PrefKeys.PREF_USER_ID, "1"));
    params.put("unique_id", unique_id);//1,2,3,4,5
    DataRequest loginRequest = new DataRequest(Method.POST, url, params, new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {
            switch (response.optInt("unique_id")) {
                case 1:
                    //task 1
                    break;
                case 2:
                    //task 2
                    break;
                default:
                    //nothing
            }
        }
    }, new ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
                //I want to know which unique_id request is failed 
        }
    });
    loginRequest.setRetryPolicy(new DefaultRetryPolicy(20000, 0, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
    AppController.getInstance().addToRequestQueue(loginRequest, tag);
} 

I'm trying to identity which request is failed with having unique_id.

I'm calling getTestDats("1") function with unique_id. And function called 10 times and all the api call in addToRequestQueue.

When API go into Success part its working as per code. But when API go into Error part I didn't identity the request. Is there any way to know my request param so I can retry with particular unique_id request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant