How to customize notification sound in Awesome Notification

178 Views Asked by At

I am trying to create an alarming notification with my alarm.wav sound. I listened to some tutorials and found that I need to put my sounds in the android/app/src/main/res/raw. when trying to push the notification using awesome_notifications package, it just plays the default device notification sound. Can someone see if I am doing something wrong because no error is poping up.

AwesomeNotifications().createNotification(
        content: NotificationContent(
            id: id,
            actionType: actionType,
            title: title,
            category: NotificationCategory.Alarm,
            criticalAlert: true,
            wakeUpScreen: true,
            channelKey: 'high_importance_channel',
            body: body,
            customSound: "resource://raw/alarm",
            // payload: json.decode(payLoad),
            ),
     );

EDIT

I also tried to pass the path as my soundSource argument but gave me this error:

[Awesome Notifications](12613): Audio media is not valid (NotificationChannelModel:58)

code:

await AwesomeNotifications().initialize(null, [
      NotificationChannel(
        channelKey: 'high_importance_channel',
        channelName: 'alert_channel',
        channelDescription: 'Alert user from certain health issues',
        playSound: true,
        soundSource: "resource://raw/alarm",
      )
    ]);
0

There are 0 best solutions below