git-subtree-dir: apps/mobile git-subtree-mainline:11490df648git-subtree-split:c7bc4fea56
43 lines
1.8 KiB
Markdown
43 lines
1.8 KiB
Markdown
---
|
|
name: android-native
|
|
description: Android 앱 진입점, 채널 등록, 앱 생명주기 관리 (Supporting Domain)
|
|
type: supporting
|
|
---
|
|
|
|
# Android Native
|
|
|
|
## 목적 / 책임
|
|
- Android 앱 진입점 및 초기화
|
|
- Flutter ↔ Android 채널(EventChannel, MethodChannel) 등록
|
|
- 알림 채널(NotificationChannel) 생성 및 관리
|
|
- 앱 생명주기(포그라운드/백그라운드) 상태 추적
|
|
|
|
## 포함 경로
|
|
- `android/app/src/main/java/com/tokilabs/mattermost/MainActivity.kt`
|
|
- `android/app/src/main/java/com/tokilabs/mattermost/MainApplication.kt`
|
|
- `android/app/src/main/java/com/tokilabs/mattermost/AppLifecycleTracker.kt`
|
|
- `android/app/src/main/AndroidManifest.xml`
|
|
- `android/app/build.gradle.kts`
|
|
|
|
## 제외 경로
|
|
- `android/.../db/` (database 도메인)
|
|
- `android/.../helpers/` (각 담당 도메인)
|
|
- `android/.../MattermostFirebaseMessagingService.kt` (push-notification 도메인)
|
|
|
|
## 주요 구성 요소
|
|
- `MainActivity`: EventChannel & MethodChannel 등록
|
|
- `MainApplication`: 앱 시작 시 알림 채널 생성, AppLifecycleTracker 등록
|
|
- `AppLifecycleTracker`: 앱 포그라운드/백그라운드 상태 추적 (ActivityLifecycleCallbacks)
|
|
|
|
## 유지할 패턴
|
|
- 알림 채널은 `MainApplication.onCreate()`에서 생성
|
|
- EventChannel ID: `com.tokilabs.mattermost/events`
|
|
- MethodChannel ID: `com.tokilabs.mattermost/methods` (또는 실제 ID 확인 후 갱신)
|
|
|
|
## 다른 도메인과의 경계
|
|
- **push-notification**: 알림 채널 생성은 android-native, 실제 알림 표시는 push-notification
|
|
- **flutter-app**: Flutter 레이어와의 통신은 채널을 통해서만, 직접 Flutter 코드 수정 지양
|
|
|
|
## 금지 사항
|
|
- 비즈니스 로직을 MainActivity/MainApplication에 넣지 않는다.
|
|
- 채널 ID를 하드코딩할 경우 반드시 상수로 추출한다.
|