我正在使用 flutter Awesome 通知,我希望用户可以从其存储中选择自定义声音。有可能做到吗? 这是我的代码来初始化很棒的通知插件。
AwesomeNotifications().initialize(
'resource://drawable/logo',
[
NotificationChannel(
channelKey: 'alarm_notification',
channelName: 'alarm_notification',
channelDescription: 'Notification channel for alarm',
defaultColor: Color(0xFFFFDA2B),
ledColor: Colors.white,
vibrationPattern: highVibrationPattern,
soundSource: 'resource://raw/slow_spring_board',
importance: NotificationImportance.Max,
)
]
);
这是我创建通知的代码
AwesomeNotifications().createNotification(
content: NotificationContent(
id: alarmId,
channelKey: 'alarm_notification',
title: alarmTitle,
body: alarmBody,
displayOnBackground: true,
displayOnForeground: true,
customSound: "string",
),
schedule: NotificationCalendar(
hour: alarmTime.hour,
minute: alarmTime.minute,
second: 0,
millisecond: 0,
timeZone: "Asia/Jakarta",
repeats: true,
)
);