I\'m following the Model View Presenter (MVP) pattern similar to Antonio Leiva\'s example found here: antoniolg/github.
I\'ve been playing around with it quite a bit and
Define class for example My App extends Application and define method like getAppInstance returns Application object and then add name attribute of this class to Applicqtion Tag in Manifest then call this method inside your use case to get context object and start your service
public class MyApp extends Application {
private MyApp instance;
@Override
public void onCreate() {
super.onCreate();
instance = this;
}
@Override
public void onTerminate() {
super.onTerminate();
instance = null;
}
public MyApp getInstance(){
return instance;
}
}