Add a Sound File to your Android App
This guide will show you how you can add a sound file to your Android app, thereby allowing you to use custom sounds for your Android push notifications.
Android supports .mp3, .ogg and .wav files for playing custom sounds.
Step 1: Adding Sound Files to Your Android Project
Right click on Resources (res) folder and select New -> Android Resource Directory.

Select Resource Type as βrawβ.

Put your MP3 file in the raw folder.

Step 2 : Registering Notification Channel For the Custom Sound File
// Creating a Notification Channel With Sound Support
CleverTapAPI.createNotificationChannel(getApplicationContext(),"got","Game of Thrones","Game Of Thrones",NotificationManager.IMPORTANCE_MAX,true,"gameofthrones.mp3");
CleverTapAPI.createNotificationChannel(getApplicationContext(),"got","Game of Thrones","Game Of Thrones",NotificationManager.IMPORTANCE_MAX,true,"gameofthrones.mp3")
Step 3: Creating Push Notifications with Custom Sounds
In the CleverTap dashboard, select Advanced β Custom Sound file and enter the name of your file with the extension in the text box.
Note
If the notification channel has a custom sound, then this sound will always override the default OS sound.

Updated over 2 years ago