Setting Up Notification Channels for Android
Starting with Android 8.0 (API 26), each notification must belong to a channel — otherwise NotificationManager.notify() silently ignores it. User manages sound, vibration, and display settings separately for each channel in system settings. Channel is created once on app first launch.
Creating Channels
val channel = NotificationChannel(
CHANNEL_ID_MESSAGES,
"Messages",
NotificationManager.IMPORTANCE_HIGH
).apply {
description = "Personal messages from other users"
enableLights(true)
lightColor = Color.BLUE
enableVibration(true)
vibrationPattern = longArrayOf(0, 250, 250, 250)
setShowBadge(true)
}
val notificationManager = getSystemService(NotificationManager::class.java)
notificationManager.createNotificationChannel(channel)
It's safe to call createNotificationChannel() on every app launch — if the channel already exists, the call is ignored. Exception: if you change name or description — it updates. If you change importance — no, user settings take precedence.
Channel Groups
For apps with many channels (news aggregator with channels for each category, messenger with channels for message types) — use NotificationChannelGroup. Groups channels in system settings:
notificationManager.createNotificationChannelGroup(
NotificationChannelGroup("group_social", "Social")
)
// Then for channel: channel.group = "group_social"
What Can't Be Changed After Creation
Importance, sound, vibration — user configures themselves, app can't override. If you need different sound for existing channel — must create new channel with new ID. Old one stays in user's system settings.
Deleting obsolete channels: notificationManager.deleteNotificationChannel(oldChannelId). Cleanup on app version update — good practice, otherwise user sees long-unused channels in settings.
FCM and Channels
Firebase Cloud Messaging with API 26+ requires android.channel_id in the payload. If channel isn't specified or doesn't exist — notification goes to default channel from AndroidManifest.xml:
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id" />
Without this record, FCM notifications on Android 8+ don't show.
Setting up notification channels with groups and FCM integration: 1 day. Cost is calculated individually.







