Dagger - android.app.IntentService with @Inject -
Is the object exposed to the Android.APIentent service by a dagger possible? If so, how can I do this?
I have to do something like that.
Public Class SomeService Android .app.IntentService {@Inject Synchronizer Synchronizer; Some public services (string names) {super (name); } @ Override Protected Zero to Intend Intent {synchronizer.doSynch (); } }
from the view of the dagger point, Intent Service is no different from any other category. The injection can look like that (I'm assuming that your application has an example of object graph and it is detected inject ). Of course, do not forget the class in the class of an injection sections in your module definition. "lang-java prettyprint-override"> Public Class SomeService provides Android.app.IntentService {@Inject Synchronizer Synchronizer; Some public services (string names) {super (name); } @ Override Public Wide On Crack () {Super. Connet (); ((Your App) getApplication ()). Inject (this); } @ Override Protected Zero with Intent Intent {synchronizer.doSynch (); }}
Comments
Post a Comment