i am creating a app, in which i want the app to send a notification at a particular time.
I am using flutter_local_notification plugin: 17.2.1.
the notification is getting scheduled , but never gets dispatched.
First I thought the system is not scheduling the notification. To confirm this I added a button to list , all the pending alarm in the system.
when I schedule a notification ,and click to see if that alarm in system list of scheduled notification, it shows that 1 notification is scheduled, but after the scheduled time is passed, then also, it shows that alarm notification in the system, That means that notification never got dispatched.
I have checked the apps battery usage and background usage is allowed. Also in notification permission, notifications are also allowed.
But, I dont know what the issue is.
Here is my AndroidManifest file code specific to notifiaction.
test Notification button logs are as below:
I/flutter ( 7766): TEST: Scheduling test notification for 2025-11-24 23:34:12.491086
I/flutter ( 7766): Scheduling for: 2025-11-24 23:34:12.491086+0530 (Timezone: Asia/Calcutta)
I/flutter ( 7766): Notification Scheduled: ID 999999 at 2025-11-24 23:34:12.491086
Below is code to schedule a Alarm.
Future scheduleNotification({
required int id,
required String title,
required String body,
required DateTime scheduledTime,
String payload = '',
}) async {
if (!(await Permission.notification.isGranted)) {
print("Cannot schedule notification: Notification Permission NOT GRANTED.");
return;
}
if (!(await Permission.scheduleExactAlarm.isGranted)) {
print("Cannot schedule notification: Exact Alarm Permission NOT GRANTED.");
return;
}
try {
await _flutterLocalNotificationsPlugin.zonedSchedule(
id,
title,
body,
_nextInstanceOfTime(scheduledTime),
const NotificationDetails(
android: AndroidNotificationDetails(
'Test_Notification_id_v2',
'Test Notification',
channelDescription: 'Channel for Test Notification',
importance: Importance.max,
priority: Priority.high,
ticker: 'ticker',
),
iOS: DarwinNotificationDetails(
presentAlert: true,
presentBadge: true,
presentSound: true,
),
),
androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle,
uiLocalNotificationDateInterpretation: UILocalNotificationDateInterpretation.absoluteTime,
payload: payload,
);
print('Notification Scheduled: ID $id at $scheduledTime');
} catch (e) {
print('Error scheduling notification: $e');
}
}
Can anyone help me with this issue?