What is difference between ActivityRetainedComponent @ActivityRetainedScope and ActivityComponent @ActivityScoped in dagger hilt android
Based on the documents. ActivityRetainedComponent
lives across configuration changes, so it is created at the first onCreate and last onDestroy, and when you mark your dependencies in ActivityRetainedComponent
with @ActivityRetainedScope
its guarantees that your object will be a singleton and survive across configuration changes. But ActivityComponent
created at onCreate
and destroyed at onDestroy
. and when you mark your dependencies in ActivityComponent
with @ActivityScope
its guarantees that your object will be a singleton but ActivityComponent
will be destroyed in configuration changes.