I'm working on an Android library that is basically a client for some REST services I've written. I have several storage classes, network queues, parsers, and so on, and like many such classes, they have dependencies on Context or on things like SharedPreferences that are constructed from Context. These objects are all hidden behind a facade class, so consumers of my library don't see them or interact with them directly.
For my own sanity, I would like to use Dagger 2 for dependency injection to manage instances of these classes INTERNALLY within my library. However, I don't want to force apps using my library to use Dagger themselves; just because I chose to use Dagger doesn't mean my users should have to.
All the tutorials I've seen seem to expect that I'm building an application, not just a library. Many of these tutorials tell me I should make my Application class inherit from DaggerApplication. In my case, though, I don't have an Application (or any Activity or Service classes) in my library at all, and I don't want my users to have to use Dagger's base classes.
So how can I use Dagger without "leaking" it out of my library? I've found a partial answer here, but I'm not sure how adapt the author's "wrapper" pattern to handle my dependency on Context. Can I just pass a context into the wrapper's getComponent() method, or will Dagger be able to obtain a Context reference some other way?