Skip to content

How to create android notification channel with custom sound

Alexander Boldyrev edited this page Oct 16, 2025 · 3 revisions

Create a custom notification channel with custom sound for Android

To enable custom sound for notifications, you need to create a custom notification channel. This is done by adding notificationChannelId, notificationChannelName and notificationSound as part of Android configuration in the InfobipMobilemessaging.init method. Note that all three fields must be provided; null or empty strings won't be accepted.

import 'package:infobip_mobilemessaging/models/configurations/configuration.dart' as mmconf;

    InfobipMobilemessaging.init(
      mmconf.Configuration(
        applicationCode: 'APP_CODE',
        androidSettings: mmconf.AndroidSettings(
          notificationChannelId: 'test-channel-id',
          notificationChannelName: 'Test Channel Name',
          notificationSound: 'my_sound',
        ),
      ),
    );

For more about Android notification channels, read Android Developers - Notification Channels

This will create a new custom notification channel with a given notificationChannelId and a notificationChannelName. It will also set the custom sound for notifications. The sound file should be placed in the Android res/raw directory of your project.

Add a sound file to the application project

Place custom sound files in your project in res/raw directory. If the folder does not exist, create it. Make sure that your file is in one of the supported audio formats.

Send message

In order for custom notification sound to be played by the OS, you need to send message by API with the name of the sound (with or without extension) by using soundName parameter in options, or Portal by filling Sound name field in Advanced Settings -> Notification Settings -> Standard -> Play Sound on Device .

Why don't I hear my custom sound?

MobileMessaging SDK builds a notification in the notification center by using default device sound. Default sound is played if:

  • custom sound name isn't set

Sound will not be played if:

  • sound file is not found by the provided name (valid name: my_sound.wav)
  • sound file is not valid, e.g., the file has a wrong extension

NOTE: Prerequisite for playing any sound is that the sound is enabled for both, a device and your application.

Clone this wiki locally