9148c358d0
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
6.0 KiB
6.0 KiB
id, title, category, status, source_trust_level, verification_status, created_at, updated_at, tags, tech_stack, applied_in, aliases
| id | title | category | status | source_trust_level | verification_status | created_at | updated_at | tags | tech_stack | applied_in | aliases | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| android-notification-patterns | Android Notification — 채널 / 권한 / 스타일 | Coding | draft | B | conceptual | 2026-05-09 | 2026-05-09 |
|
|
|
Android Notification
Android 8+ = NotificationChannel 필수. Android 13+ = POST_NOTIFICATIONS 권한. Style (BigText/Inbox/Messaging) 으로 풍부. FCM 으로 push.
📖 핵심 개념
- Channel: 카테고리 (chat / promo / system). 사용자가 채널별 설정.
- Importance: HIGH (heads-up), DEFAULT, LOW, MIN.
- Style: 단순 / BigText / BigPicture / Messaging / Media.
- Action: 인라인 버튼 + 답장 입력.
💻 코드 패턴
Channel 생성 (앱 시작)
class App : Application() {
override fun onCreate() {
super.onCreate()
val nm = getSystemService<NotificationManager>()!!
nm.createNotificationChannels(listOf(
NotificationChannel("chat", "Chat", NotificationManager.IMPORTANCE_HIGH).apply {
description = "New messages"
enableVibration(true)
setSound(soundUri, audioAttrs)
},
NotificationChannel("promo", "Promotions", NotificationManager.IMPORTANCE_LOW),
))
}
}
권한 (13+)
private val launcher = registerForActivityResult(ActivityResultContracts.RequestPermission()) { granted -> }
if (Build.VERSION.SDK_INT >= 33 &&
ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
launcher.launch(Manifest.permission.POST_NOTIFICATIONS)
}
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
단순 notification
val pi = PendingIntent.getActivity(ctx, 0,
Intent(ctx, MainActivity::class.java), PendingIntent.FLAG_IMMUTABLE)
val notif = NotificationCompat.Builder(ctx, "chat")
.setSmallIcon(R.drawable.ic_chat)
.setContentTitle("Alice")
.setContentText("Hi there")
.setContentIntent(pi)
.setAutoCancel(true)
.build()
NotificationManagerCompat.from(ctx).notify(notifId, notif)
BigText (긴 본문)
.setStyle(NotificationCompat.BigTextStyle().bigText(longBody))
MessagingStyle (chat)
val you = Person.Builder().setName("You").build()
val alice = Person.Builder().setName("Alice").setIcon(...).build()
val style = NotificationCompat.MessagingStyle(you)
.setConversationTitle("Alice")
.addMessage("Hi", System.currentTimeMillis() - 60_000, alice)
.addMessage("Hello", System.currentTimeMillis(), you)
builder.setStyle(style)
Action + RemoteInput (답장)
val replyKey = "key_reply"
val remoteInput = RemoteInput.Builder(replyKey).setLabel("Reply").build()
val replyPI = PendingIntent.getBroadcast(ctx, 0,
Intent(ctx, ReplyReceiver::class.java).putExtra("convId", convId),
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE)
val replyAction = NotificationCompat.Action.Builder(R.drawable.ic_reply, "Reply", replyPI)
.addRemoteInput(remoteInput)
.setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_REPLY)
.build()
builder.addAction(replyAction)
class ReplyReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val text = RemoteInput.getResultsFromIntent(intent)?.getCharSequence("key_reply").toString()
// send + update notification
}
}
FCM (push)
class MyFcmService : FirebaseMessagingService() {
override fun onMessageReceived(msg: RemoteMessage) {
val data = msg.data
showNotification(data["title"] ?: "", data["body"] ?: "")
}
override fun onNewToken(token: String) {
// 서버에 등록
}
}
<service android:name=".MyFcmService" android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
Group + summary
val groupKey = "messages-group"
val notif1 = NotificationCompat.Builder(ctx, "chat").setGroup(groupKey).build()
val notif2 = NotificationCompat.Builder(ctx, "chat").setGroup(groupKey).build()
val summary = NotificationCompat.Builder(ctx, "chat")
.setGroup(groupKey).setGroupSummary(true)
.setSmallIcon(R.drawable.ic_chat)
.setContentTitle("3 new messages")
.build()
Heads-up (떠 있는 알림)
NotificationChannel(..., IMPORTANCE_HIGH) // 채널이 HIGH
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
.setFullScreenIntent(pi, true) // 전화 같은 거 (lock screen 도)
Image / Avatar
.setLargeIcon(bitmap)
.setStyle(NotificationCompat.BigPictureStyle().bigPicture(bigBitmap))
🤔 의사결정 기준
| 종류 | 채널 / 스타일 |
|---|---|
| 채팅 | HIGH + MessagingStyle + reply action |
| 시스템 (sync 완료) | LOW + 단순 |
| 마케팅 / promo | LOW + dismissable |
| 진행 중 (다운로드) | LOW + progress |
| 알람 / 콜 | HIGH + fullScreenIntent |
❌ 안티패턴
- Channel 안 만들고 notify: 8+ 에서 안 보임.
- 권한 미요청 (13+): silently 차단.
- 모든 채널 HIGH: 사용자 끄기. 적절히.
- PendingIntent FLAG_IMMUTABLE 누락 (12+): SecurityException.
- Group summary 누락 + 많은 알림: 사용자 화남.
- Image inline base64 큼: 메모리.
setOngoing(true)잘못 쓰면 dismiss 못 함.- Channel 삭제 + 재생성: 사용자 설정 잃음.
🤖 LLM 활용 힌트
- Channel + 권한 (13+) + Style + Action 4종.
- FCM + onMessageReceived → showNotification.
- Group key + summary.