Feature Request: Identifier for every request

66 views
Skip to first unread message

Pirdad Sakhizada

unread,
Jan 8, 2015, 3:10:10 PM1/8/15
to volley...@googlegroups.com
Hi,

First of I would like to say, this is a great library that i've been using since IO 2013.
There's been a few times that I wished every request had the ability to take an id which could be passed along with the result on the callback functions.
Although, the library is extensible, I think this would be great to be handled on the base com.android.volley.Request class.

Example:

new Response.Listener<Model>() {

        @Override
        public void onResponse(long requestId, Model response) {

            // code here
        }
    }

AND

new Response.ErrorListener() {

        @Override
        public void onErrorResponse(long requestId, VolleyError error) {
            
             // code here
        }
    }

Thanks.

Ficus Kirkpatrick

unread,
Jan 10, 2015, 5:32:49 PM1/10/15
to Pirdad Sakhizada, volley...@googlegroups.com
What would you use this for?

--
You received this message because you are subscribed to the Google Groups "Volley Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to volley-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pirdad Sakhizada

unread,
Jan 13, 2015, 12:08:32 PM1/13/15
to volley...@googlegroups.com, pir...@gmail.com
Recently, I wanted to use volley to make a bunch of requests through a service that would save the responses to disk and return the parsed object (basically an offline mode feature). Unlike a regular request on an Activity/Fragment, I would have to manage each of my requests.

I would need to know which ones are completed and which ones failed. I know that each request have #hasHadResponseDelivered() but it's not useful if you don't know which Request object to check on specially if you are implementing the listener interface instead of using it as anonymous class.

Cheng Chi

unread,
Jan 17, 2015, 11:28:34 AM1/17/15
to volley...@googlegroups.com
+1

My use case:

Some times the response is lost due to mobile network. Volley will retry the request automatically and server insert a new record for the second request. With a unique id in the request (and use same id in the retry request), I can add a cache layer on server, if there is a result for the request id, simply returns the result from previous response.
Reply all
Reply to author
Forward
0 new messages