FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
// initialization of flutter local notifications plugin
var initializationSettingsAndroid =
AndroidInitializationSettings('@mipmap/ic_launcher');
var initializationSettingsIOS = DarwinInitializationSettings();
var initializationSettings = InitializationSettings(
android: initializationSettingsAndroid, iOS: initializationSettingsIOS);
flutterLocalNotificationsPlugin.initialize(initializationSettings);
}
int hour = int.parse(selectedTime.hour.toString());
int minute = int.parse(selectedTime.minute.toString());
final alarmId = DateTime.now().millisecondsSinceEpoch.remainder(100000);
);
// scheduling local notification
await flutterLocalNotificationsPlugin.zonedSchedule(
newAlarm.id,
'Alarm',
'Alarm ${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')} için ayarlandı',
scheduledDate,
const NotificationDetails(
iOS: DarwinNotificationDetails(
sound: 'a_long_cold_sting.wav',
presentAlert: true,
presentBadge: true,
presentSound: true,
),
android: AndroidNotificationDetails(
'alarm_channel', 'Alarm Channel',
channelDescription: 'Alarm Channel',
importance: Importance.high,
priority: Priority.high,
enableVibration: true,
playSound: true,
sound: RawResourceAndroidNotificationSound('default_alarm'),
showWhen: false)),
androidAllowWhileIdle: true,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime,
payload: newAlarm.name,
matchDateTimeComponents: DateTimeComponents.dayOfWeekAndTime);
Navigator.pop(context);
}
permissions granted and checked that the alarm has been added
The purpose of the code is to add an alarm on a page and process it in the database and trigger the notification when the time comes, but the notification does not appear even though the alarm is added without any problems.