Search code examples
androidkotlinpush-notificationandroid-notifications

Custom notification sounds not working if app is closed


I am trying to implement custom notification sounds. There are two different sounds, one for message and one for call, the sounds work when the app is running and I get a notification but phone's default sound will ring if the app is closed and removed from recent as well. I have used Firebase for notifications.


Solution

  • This is happening mostly as you were getting the notification payload in the push notification. Whenever we get the notification and data both in the fcm payload. Notification tag is always accessed using the system tray of the android system. So it will not consider your custom notification setting.

    Try to get only the data in the fcm payload and not the notification.