Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Robospice in android.os.Service context

According to RoboSpice documentation https://github.com/octo-online/robospice/wiki/Design-of-RoboSpice , i can use it in any Context.

Can't find an example of using Robospice in service context. I did some attempts but nothing happened, requests just not executes, no exceptions (Maybe some log leaking, what i need to do to enable robospice log on device?)

  1. Where to start/stop it? (spiceManager.start(this) / spiceManager.shouldStop())
  2. Where to create SpiceManager instance? (My service starts in application.onCreate() method, maybe i have 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();
    }
}
like image 359
Dmitriy Voronin Avatar asked Jan 29 '13 09:01

Dmitriy Voronin


1 Answers

Shame on me ...

After drinking some coffee i spotted that child Service, dont have super.onCreate() call to start spiceManager.

It's working perfectly fine now! Sorry for your time.

like image 138
Dmitriy Voronin Avatar answered Oct 29 '22 17:10

Dmitriy Voronin