0

我正在使用颤振很棒的通知,我希望用户可以从他们的存储中选择自定义声音。有可能做到吗?这是我初始化很棒的通知插件的代码。

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,
  )
);
4

0 回答 0