I copied the mp3 (kalimba.mp3) file into the raw folder in the res folder. But when the notification is triggered it produces the default sound.
I have implemented this way to set custom Notification sound in my app.
int notificationID=001;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);
mBuilder.setSmallIcon(R.drawable.room);
mBuilder.setContentTitle("Room Rent , Pay Room Rent");
mBuilder.setContentText("Hi, Its time to pay your Room Rent!");
mBuilder.setAutoCancel(true);
mBuilder.setColor(getResources().getColor(R.color.colorViolet));
mBuilder.setSound(Uri.parse("android.resource://com.roommanagement.app/" + R.raw.notification_sound));
if (mNotificationManager!=null){
mNotificationManager.notify(notificationID, mBuilder.build());
}
Hop this will help you.Thanks...