Using RoboSpice for asynchronus threading

85 views Asked by At

I am trying to use RoboSpice for my Android app but I am getting very confused with the documentation.

Basically, I would like to implement only an asynchronous service in the background of the app which does not get destroyed when the activity is changed etc for a thread that I run, much like the infographic that they have shown here. How would I do this? I have a base activity so I have added the SpiceService to the onStart() and onStop() functions as instructed but I am unsure what to use as the custom SpiceService itself?

1

There are 1 answers

1
nekojsi On BEST ANSWER

RoboSpice is designed to be tied to Android's activity lifecycle, so stopping the SpiceService between Activity changes is normal. The component that remains persistent between activities is its cache. You can try, however, holding a SpiceService active throughout your app lifecycle by tying it to your Application context, but that is not recommended.

About the other part of your question (what custom SpiceService to use), you should probably check the offline example.