What is difference between ActivityRetainedComponent @ActivityRetainedScope and ActivityComponent @ActivityScoped in dagger hilt android
What is difference between ActivityRetainedComponent @ActivityRetainedScope and ActivityComponent @ActivityScoped in dagger hilt android
5.6k Views Asked by Abhijith mogaveera At
2
Based on the documents.
ActivityRetainedComponentlives across configuration changes, so it is created at the first onCreate and last onDestroy, and when you mark your dependencies inActivityRetainedComponentwith@ActivityRetainedScopeits guarantees that your object will be a singleton and survive across configuration changes. ButActivityComponentcreated atonCreateand destroyed atonDestroy. and when you mark your dependencies inActivityComponentwith@ActivityScopeits guarantees that your object will be a singleton butActivityComponentwill be destroyed in configuration changes.