Я могу отправлять уведомления без проблем, но я хочу, чтобы они звучали как будильник. Как мне сделать так, чтобы звук будильника по умолчанию был звуком, который будет слышен при появлении уведомления?
Это мой код (я просто хочу сделать это для Android):
// Flutter Local Notification.
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
AndroidInitializationSettings androidInitializationSettings;
IOSInitializationSettings iosInitializationSettings;
InitializationSettings initializationSettings;
void initializing() async {
androidInitializationSettings = AndroidInitializationSettings('app_icon');
iosInitializationSettings = IOSInitializationSettings(onDidReceiveLocalNotification: onDidReceiveLocalNotification);
initializationSettings = InitializationSettings(androidInitializationSettings, iosInitializationSettings);
await flutterLocalNotificationsPlugin.initialize(initializationSettings, onSelectNotification: onSelectNotification);
}
void showNotifications(taskID, taskTitle, taskDate) async {
await notification(taskID, taskTitle, taskDate);
}
Future<void> notification(taskID, taskTitle, taskDate) async {
AndroidNotificationDetails androidNotificationDetails = AndroidNotificationDetails(
'second channel ID',
'second Channel title',
'second channel body',
priority: Priority.High,
importance: Importance.Max,
//sound: ** Default Alarm Sound **,
//playSound: true,
);
IOSNotificationDetails iosNotificationDetails = IOSNotificationDetails();
NotificationDetails notificationDetails = NotificationDetails(androidNotificationDetails, iosNotificationDetails);
await flutterLocalNotificationsPlugin.schedule(
taskID,
'Don\'t Forget Your task!',
taskTitle,
taskDate,
notificationDetails,
payload: 'Send',
);
}
Future onSelectNotification(String payload) async {
if (payload != null) {
print(payload);
}
}