it on the Application @Component @Component interface MangroveComponent class MangroveApplication : Application() { val component: MangroveComponent by lazy { DaggerMangroveComponent.create() } }
same type Qualifiers @Provides fun provideApiKey(): String = "110b1a3cd59a299dc8a1f14" @Provides fun provideCacheFileName(): String = "mangrove-cache" e: /Users/joshuajamison/Projects/personal/Mangrove/app/build/tmp/kapt3/ stubs/debug/com/codeundone/mangrove/MangroveComponent.java:7: error: java.lang.String is bound multiple times:
same type Qualifiers @Provides @ApiKey fun provideApiKey(): String = "110b1a3cd59a299dc8a1f14" @Provides @CacheFile fun provideCacheFileName(): String = "mangrove-cache"
Can be done from a module included by the parent Component, or by the Subcomponent’s dependencies parameter. Module defined subcomponents are general recommended. Subcomponents
fun inject(target: MangroveApplication) fun userComponentBuilder(): UserComponent.Builder @Component.Builder interface Builder { @BindsInstance fun appContext(context: Context): Builder fun build(): MangroveComponent } }A
lifecycle of scoped component. Activity scoped components stored on an Activity inherit same lifecycle. Activity lifecycle → destroyed and recreated from system events: eg. rotation, phone call. Lifecycle Concerns
Lifecycle aware components. Architecture Components LifecycleObserver → Handles disconnecting from a LifecycleOwner when the lifecycle is ending. LifecycleOwner → Free with Support activities and fragments.