Skip to content

Notification channels

Ivan Krešić edited this page Nov 19, 2026 · 1 revision

Notification channels

On Android 8.0 (API 26) and later, every notification is posted to a notification channel. The Mobile Messaging SDK creates and routes to its default channels unless you configure channel behavior. The default behavior remains unchanged when no notification-channel configuration is supplied. Channel configuration applies to push and In-app chat message notifications. Call notifications of Infobip RTC calls and UI keep their own channels.

This page describes how to use SDK-created channels or route notifications to channels owned by your app. For changing the names shown in Android Settings, see Notification channel names. For other notification display options, see Notification settings.

Choose a configuration

Goal API
Keep the SDK's existing channel behavior No channel configuration is needed
Use one channel for SDK notifications withSingleNotificationChannel(...)
Define routing or channels declaratively withNotificationChannelConfig(...)
Disable SDK default channels withoutDefaultNotificationChannels(), or withoutDefaultChannels() in the config
Make an app-specific, per-notification decision in native code withNotificationChannelResolver(...) or MobileMessaging.setNotificationChannelResolver(...)
Add a custom sound channel while using the SDK's default channels withCustomNotificationChannel(...)

Channel configuration applies on Android API 26 and later. On earlier Android versions, there are no notification channels, and the SDK's pre-Android 8 notification behavior is unchanged.

Use a single channel

The convenience method creates and uses one channel for notifications displayed by the SDK. Supply a stable channel ID and the name users should see in Android Settings. A description can also be supplied.

MobileMessaging.Builder(application)
    .withSingleNotificationChannel("general", "General updates")
    .build()

Java:

new MobileMessaging.Builder(application)
        .withSingleNotificationChannel("general", "General updates")
        .build();

To provide a description, use the overload with a third argument:

new MobileMessaging.Builder(application)
        .withSingleNotificationChannel("general", "General updates", "Updates from the app")
        .build();

The SDK creates this channel with default importance, the default sound and vibration. On Android 8.0 and later, the channel's settings apply to every notification in it, so notifications aren't shown as heads-up and a message's custom sound isn't played. Only messages with neither sound nor vibration stay silent. To set the importance, sound, vibration or a localized name of the single channel, pass a channel definition instead:

new MobileMessaging.Builder(application)
        .withNotificationChannelConfig(NotificationChannelConfig.builder()
                .withSingleChannel(NotificationChannelDefinition.builder("general_alerts")
                        .withNameResource("channel_general")
                        .withImportance(NotificationChannelDefinition.Importance.HIGH)
                        .build())
                .build())
        .build();

With high importance, notifications displayed while the app is in the foreground are shown as heads-up too. Android keeps the importance of an existing channel, so use a new channel ID when you change it. In debug builds, the SDK logs a warning when heads-up notifications are enabled but end up in a single channel without high importance.

Configure channels declaratively

NotificationChannelConfig lets you disable the SDK's default channels, define channels for the SDK to create, and map notification types to channel IDs. Each mapped ID must refer to a channel that exists. Add channel definitions to the config if the SDK should create those channels; otherwise, create the channels in your app before notifications are posted.

For the convenience shortcut, call the builder's withoutDefaultNotificationChannels() method to disable the SDK's default channels without constructing a config. Existing channels are not deleted, and the SDK can still use its fallback channels. If you want notifications routed to app-owned channels, define those channels and provide mappings, a payload key, or a resolver.

The builder's withSingleNotificationChannel(...) and withoutDefaultNotificationChannels() are applied on top of the config passed to withNotificationChannelConfig(...), regardless of the order in which you call them. Calling withNotificationChannelConfig(...) again replaces the previous config.

The SDK persists the channel configuration and replaces it on every build(), so pass it each time you build the SDK. If you build without withNotificationChannelConfig(...), withSingleNotificationChannel(...) or withoutDefaultNotificationChannels(), the SDK creates and uses its default channels again. Channels created earlier aren't deleted.

The following example defines a general, high-priority, and quiet channel, then maps notifications to them:

NotificationChannelConfig config = NotificationChannelConfig.builder()
        .withoutDefaultChannels()
        .addChannel(NotificationChannelDefinition.builder("general")
                .withName("General updates")
                .withImportance(NotificationChannelDefinition.Importance.DEFAULT)
                .build())
        .addChannel(NotificationChannelDefinition.builder("alerts")
                .withName("Important alerts")
                .withImportance(NotificationChannelDefinition.Importance.HIGH)
                .withSound("ding") // res/raw/ding, or "default" / "none"
                .build())
        .addChannel(NotificationChannelDefinition.builder("quiet")
                .withName("Quiet updates")
                .withImportance(NotificationChannelDefinition.Importance.LOW)
                .withSound("none")
                .build())
        .withChannelMapping(NotificationChannelMapping.builder()
                .withDefaultChannelId("general")
                .withHighPriorityChannelId("alerts")
                .withSilentChannelId("quiet")
                .build())
        .build();

new MobileMessaging.Builder(application)
        .withNotificationChannelConfig(config)
        .build();

A channel definition can specify its ID, name and description, importance, sound, vibration, and badge behavior. Values you don't set default to Importance.DEFAULT, the default sound, vibration, and the badge, so set withVibration(false) for a channel with default or high importance that shouldn't vibrate. To localize the name and description, pass the name of a string resource, not its R.string ID, to withNameResource("channel_general") and withDescriptionResource(...). Resources take precedence over withName(...) and withDescription(...), which are used if the resource isn't found. If a definition has no name, the SDK uses the app name when it creates the channel, and keeps the name of a channel that already exists, for example one your app created itself. A custom sound is specified by the basename of a file in res/raw (without the extension); use "default" for the default sound or "none" for no sound. If the sound file isn't found, the SDK logs a warning and uses the default sound.

NotificationChannelMapping supports IDs for default, high-priority, silent, and in-app chat notifications. Only set mappings for channels you have created or that already exist in the app.

Select a channel from the message payload

To use a channel ID supplied in a message's custom payload, configure the payload key:

NotificationChannelConfig config = NotificationChannelConfig.builder()
        .withoutDefaultChannels()
        .withPayloadChannelIdKey("androidChannelId")
        // Add the channel definitions or mappings required by your app.
        .build();

When the payload value is a non-blank ID of an existing channel, that channel is selected before the configured mappings. A missing, blank, or unknown channel ID is ignored and the SDK continues with the other configured routing rules. Ensure that messages only specify channel IDs that exist in the app.

Channel selection and fallback

When a config is set, the SDK suggests a channel for each notification using the first applicable rule whose channel exists:

  1. A valid channel ID from the configured custom-payload key.
  2. The mapped in-app chat channel, for a chat message. A message that only opens the in-app chat when tapped, such as one with the Open chatbot in LiveChat action, isn't a chat message.
  3. The mapped silent channel, when the notification has neither sound nor vibration.
  4. The mapped high-priority channel, for a high-priority notification. A notification is high priority when heads-up notifications are enabled, which is the default (see Notification settings), and the app is in the background, the message uses the banner in-app style, or the SDK is built with withBannerForegroundNotifications().
  5. The mapped default channel.
  6. The configured single channel.
  7. The SDK's default channels, if they are enabled.
  8. One of the SDK fallback channels (see below).

The silent channel is checked before the high-priority channel. When heads-up notifications are enabled, every notification displayed while the app is in the background is high priority, so with the reverse order silent messages displayed in the background would never reach the silent channel.

A rule whose channel doesn't exist is skipped, and the SDK logs a warning. For example, if the mapped in-app chat channel doesn't exist, a chat message continues with the next rule that applies. For a chat message displayed while the app is in the background, that's usually the mapped high-priority channel.

If a custom resolver is also configured, it runs after the SDK has selected a suggested channel. The suggestion is always a channel that exists, or one of the fallback channels, which the SDK creates if it's used. The resolver can keep that suggestion or return another existing channel ID. If the resolver throws an exception or returns an ID of a channel that doesn't exist, the SDK logs a warning and uses the suggested channel. This ensures that the SDK does not try to post a notification to a missing channel.

The SDK has eight fallback channels, one for each combination of sound, vibration and priority, like its default channels. Each is created the first time it's needed:

Channel ID Used for Behavior
mm_fallback_channel Notifications with sound and vibration Default importance, default sound, vibration
mm_fallback_channel_vibration Notifications with vibration only Default importance, no sound, vibration
mm_fallback_channel_sound Notifications with sound only Default importance, default sound, no vibration
mm_fallback_channel_quiet Notifications with neither sound nor vibration Default importance, no sound, no vibration
mm_fallback_channel_high_priority Heads-up notifications with sound and vibration High importance, default sound, vibration
mm_fallback_channel_high_priority_vibration Heads-up notifications with vibration only High importance, no sound, vibration
mm_fallback_channel_high_priority_sound Heads-up notifications with sound only High importance, default sound, no vibration
mm_fallback_channel_high_priority_quiet Heads-up notifications with neither sound nor vibration High importance, no sound, no vibration

The fallback channels can't play a message's custom sound; they play the default sound instead. If the SDK's default channels are disabled, map a default channel or configure a single channel so that notifications aren't routed to a fallback channel. To rename the fallback channels, see Notification channel names.

Use a native resolver

A NotificationChannelResolver is an optional Java callback for native apps that need to make a per-notification decision. It receives a NotificationChannelContext, which provides the message, the SDK-suggested channel ID, and notification properties such as sound, vibration, priority, and whether the message is an in-app chat message.

Register the resolver on the builder:

new MobileMessaging.Builder(application)
        .withNotificationChannelResolver(context -> {
            // Apply app-specific routing and return an existing channel ID.
            return context.getSdkSuggestedChannelId();
        })
        .build();

If your app builds the SDK in Application.onCreate(), the builder resolver is also set when a push starts the app process. If your app builds the SDK later, for example in an activity as in the quick start, or doesn't build it with the native MobileMessaging.Builder at all, for example a cross-platform plugin app, register the resolver with the static API from the native Application.onCreate():

MobileMessaging.setNotificationChannelResolver(resolver);

A resolver passed to withNotificationChannelResolver(...) takes precedence over the one set with setNotificationChannelResolver(...). Each build() replaces the builder's resolver, so building without it removes it and the static one is used again. Pass null to setNotificationChannelResolver(...) to remove the static resolver.

The resolver is kept in memory and must be registered again when the app process starts. The declarative NotificationChannelConfig, in contrast, is persisted by the SDK until the next build() and is available when handling a notification on a cold start. Keep resolver work fast and non-blocking; return an ID for a channel that already exists.

Custom sound channels

withCustomNotificationChannel(channelId, channelName, notificationAudio) is the existing API for adding a custom-sound channel while retaining the SDK's default channel behavior. When defining app-owned channels through NotificationChannelConfig, specify their sound in the corresponding NotificationChannelDefinition instead.

withCustomNotificationChannel(...) is ignored when the SDK's default channels are disabled with withoutDefaultNotificationChannels(), withSingleNotificationChannel(...), or a config with withoutDefaultChannels() or withSingleChannel(...). The SDK then logs a warning and doesn't create or use the custom-sound channels. A channel selected by the custom-payload key or a mapping also takes precedence over them.

Channel lifecycle and migration

Android notification channels are persistent and are not automatically deleted when the app changes configuration or is upgraded. Keep channel IDs stable: changing an ID creates a different channel and may leave the previous one visible in Android Settings.

When the SDK or app updates an existing channel, Android preserves the user's channel choices, including its importance, sound, and vibration. Configured names and descriptions can be refreshed, for example after the app's language changes, but channel behavior settings should not be treated as mutable after channel creation.

Disabling the SDK's default channels does not remove channels already created on a user's device. To explicitly remove SDK-owned default and custom-sound channels after disabling the defaults, call:

boolean deleted = MobileMessaging.getInstance(context)
        .deleteSdkDefaultNotificationChannels();

This operation does not delete app-owned channels and removes the user's settings for the SDK channels it deletes. Only channels named in the NotificationChannelConfig are kept. The SDK can't detect SDK channels that a resolver or the custom-payload key still selects, so make sure neither uses SDK default or custom-sound channels before you call it. After deletion, they're treated as missing channels. It is an explicit migration action; do not call it unless removing those channels and their user customizations is intended. The method returns true if it deleted at least one channel. It returns false when there was nothing left to delete, when the SDK defaults have not been disabled, or when channels are not supported on the device.

Clone this wiki locally