반응형
Application 클래스란?
Application 클래스는 Android 애플리케이션의 전반적인 상태를 관리하는 기본 클래스입니다.
앱이 실행될 때 가장 먼저 생성되며, 앱이 종료될 때까지 유지됩니다.
- 싱글톤처럼 동작하며, 어디서든 접근 가능
- 앱의 생명 주기 관리
- 앱 전역에서 공유해야 하는 데이터(예: SharedPreferences, DI Container, Theme, Locale 등)를 관리
- 의존성 주입(Dagger/Hilt), Firebase 초기화, Crashlytics 설정 등 각종 초기설정을 여기서 진행
- 반드시 Manifest에 선언해주어야 한다.
<application
android:name=".MyApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
</application>
반응형