so have class injectable:
@singleton public class friendmessagelistimpl { @inject riotrostermanager riotrostermanager; @singleton @inject public friendmessagelistimpl() { } } my component injected in application class:
appcomponent = daggerappcomponent.builder() .appmodule(new appmodule(this)) .build(); @singleton @component( modules = { appmodule.class } ) public interface appcomponent { /** * core */ void inject(...); } the objected injected first time background service running.
the objects should singleton application scope, mean 1 instance long service lives. i'm not sure if case, reason singleton seems not have application scope. there way can force it? , scope supposed have considering code?
from understood, have 1 component created in application class, , altought object injected thru constructor, shares same scope component. wrong?
from description seems background service running after app first started application object stays live (until service stopped , activities finished). seems pretty fine, not need create graph again, existing instance.
Comments
Post a Comment