I am using the Awesome Notifications package in Flutter to handle notifications across both Android and iOS. While I can successfully implement custom notification sounds on Android, I am facing issues with iOS where no sound is played when a notification is received. If I remove the soundSource parameter, the default notification sound plays without any issues.
Here’s the NotificationChannel configuration I am using:
NotificationChannel(
channelKey: notif.notificationIdIlacZamani_key(),
channelName: notif.notificationIdIlacZamani_kanal_adi(),
channelDescription: notif.notificationIdIlacZamani_kanal_aciklama(),
playSound: true,
//soundSource: 'resource://raw/tunnel', //for android
soundSource: 'tunnel.caf', //for ios
onlyAlertOnce: true,
groupAlertBehavior: GroupAlertBehavior.Children,
importance: NotificationImportance.Max,
defaultPrivacy: NotificationPrivacy.Public,
defaultColor: Colors.deepPurple,
ledColor: Colors.deepPurple,
)
I have placed the tunnel.caf file in the ios/Runner/Resources
folder of my project. If I remove the soundSource
parameter, the default notification sound plays on iOS.
I’ve already tried the following:
- Ensuring the sound file format is compatible with iOS (.caf in this
case) - Checking the file path and name for any errors
- Testing on a real iOS device, not just the simulator
- Added tunnel.caf to the iOS project in Xcode under Runner/Resources and Runner/Assets and Runner/
However, the custom sound still doesn’t play. What am I missing or doing wrong? How can I get custom notification sounds working on iOS?