I have developed for appstore before and I used ASIHTTPRequest
. Is there something similar for Android?
Am looking at making a few HTTP requests, which are queued and manageable. This is what I need to do:
- Set-up a queue of lets say 6 http requests.
- Once the queue is setup, execute it with each request giving me a success/failure result.
- If one request fails, I have the option to cancel/clear the whole queue.
- If all the requests in the queue are successful, I can have another callback for the whole queue's success event.
- And,each request can have a retry count; meaning; I can say each request can retry n number of time before they can return a failure.
ASIHTTPRequest
for IOS was pretty good at handling this. Is there anyway I can do this with Android? Most of my content returned is XML and no binary data.
Any feedback is much appreciated.
What you describe is not overly complicated to build.
- Extend java.util.Queue
- Create custom "listener" interface which handles all the events you need to track.
- Custom request objects that allow a "listener" to be set.
- Your custom queue will have a thread to process items in it's own queue.
- Depending on your exact requirements, you may also need an additional interface/listener to pass back the final response to the object that made the initial request.
When adding an object to the queue, your queue would set itself as the "listener" on the custom request object.
When the events happen in the request object, the event methods will be called on the listener object...in the case the queue...which can react appropriately.
I suspect something like ASIHTTPRequest does not really exist in Java/Android, because it's not as difficult a problem to solve as on iOS. I could implement the above objects into a functional component in 20 minutes or less. Of course, if you've not done something like this before, it may take you much longer.