Question

I need to execute some requests, each request is followed by another request, eg:

When I invoke request B I need data received from request A response, when request C is invoked it needs data received from request B response and so on.

All my requests are user independent, magic should happen in background and result should be saved in database. I want to launch my request sequence from activity A and let user use app. I have 2 activity and some fragments so user can move freely around them.

So my question is: where should I handle my requests (where to create them, where to keep logic of RequestListener). Should I make service for my requests which have its own SpiceManager or maybe i can handle requests/response in my RetrofitSpiceService?

Was it helpful?

Solution

Seems like I have answer.

I got rid of Robospice and I'm executing request synchronously in IntentService.

OTHER TIPS

I have never used Robospice before, but judging by it's README on Github I don't see why you would need to make your own service when it,

executes network requests asynchronously (in a background AndroidService)

Looks like it creates the Service for you, you just need to kick off Robospice.

Basically, with RoboSpice you should have used a listener of request A to execute a request of type B.

That can be done inside an activity, or any other context. I believe that in your case, I would have done this inside a service, that would itself use RoboSpice to execute requests. The service would just be used as a long lasting context to queue one request after another.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top