According to RoboSpice documentation https://github.com/octo-online/robospice/wiki/Design-of-RoboSpice , I can use it in any context.
Cannot find an example of using Robospice in the context of a service. I made several attempts, but nothing happened, the requests just do not execute, no exceptions (maybe some kind of leak log, what do I need to do to enable logospice log on device?)
- Where to start / stop? (spiceManager.start (this) /spiceManager.shouldStop ())
- Where to create an instance of SpiceManager? (My service starts in the application.onCreate () method, maybe I need to wait for some SpiceService initialization?)
some code
public abstract class SpicyService extends Service {
private SpiceManager spiceManager = new SpiceManager(SpiceService.class);
@Override
public void onCreate() {
super.onCreate();
spiceManager.start(this);
}
@Override
public void onDestroy() {
spiceManager.shouldStop();
super.onDestroy();
}
}
source