← ClaudeAtlas

android-notifications-pushlisted

Push notification and local notification patterns for Android - FCM setup, FirebaseMessagingService, notification channels, NotificationCompat.Builder, deep-link on tap via PendingIntent and NavDeepLinkBuilder, foreground vs background delivery, POST_NOTIFICATIONS permission on Android 13+, data-only vs notification messages, grouping, and badges. Use this skill whenever adding push notifications, configuring Firebase Cloud Messaging, showing local notifications, handling notification taps, or creating notification channels. Trigger on phrases like "push notification", "FCM", "Firebase messaging", "notification channel", "local notification", "notification tap", "POST_NOTIFICATIONS", "data message", or "notification badge".
lenorebreakneck630/claude-zero-to-hero-android-KMP · ★ 1 · AI & Automation · score 64
Install: claude install-skill lenorebreakneck630/claude-zero-to-hero-android-KMP
# Android Notifications and Push (FCM) ## Core Principles - Create notification channels once at app startup, never lazily on first use. - Every notification must belong to a channel — the system ignores notifications without one on API 26+. - Request POST_NOTIFICATIONS permission before showing any notification on Android 13+ (API 33+). - Keep FirebaseMessagingService thin: parse the message payload, delegate to a use case or repository. - Data-only FCM messages always arrive in onMessageReceived; notification messages only arrive there when the app is in the foreground. - Deep-link destinations on tap must be validated exactly as external deep links — they are untrusted input. --- ## Project Setup ### Gradle dependencies ```kotlin // build.gradle.kts (app module) dependencies { implementation(platform("com.google.firebase:firebase-bom:33.1.0")) implementation("com.google.firebase:firebase-messaging-ktx") implementation("androidx.core:core-ktx:1.13.1") // NotificationCompat implementation("androidx.navigation:navigation-compose:2.7.7") } ``` Add `google-services.json` to the `app/` directory and apply the plugin: ```kotlin // app/build.gradle.kts plugins { id("com.google.gms.google-services") } ``` ```kotlin // root build.gradle.kts plugins { id("com.google.gms.google-services") version "4.4.2" apply false } ``` --- ## Notification Channels Create channels once in `Application.onCreate()` — creating an existing channel is a no-op