-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Describe the bug
Notification did not shown when the app is in foreground state on IOS
To Reproduce
Here is the code i use, i am setting all present option to true, but the notification did not show up. it's only showing up when the app is minimized.
await flutterLocalNotificationsPlugin.show(
99,
'title'
'notification body',
NotificationDetails(
android: AndroidNotificationDetails(),
iOS: DarwinNotificationDetails(
sound: "adzan.aiff",
interruptionLevel: InterruptionLevel.timeSensitive,
presentSound: true,
presentList: true,
presentAlert: true,
presentBadge: true,
presentBanner: true,
)
),
);Expected behavior
As stated on readme, default behavior for IOS is to show notification even on foreground. But even after setting the presentation option to true it didn't show up.
For iOS 10+, use the presentation options to control the behaviour for when a notification is triggered while the app is in the foreground. The default settings of the plugin will configure these such that a notification will be displayed when the app is in the foreground.
Sample code to reproduce the problem
/// initialization part
final InitializationSettings initializationSettings = InitializationSettings(,
iOS: DarwinInitializationSettings(
defaultPresentAlert: true,
defaultPresentBadge: true,
defaultPresentBanner: true,
defaultPresentSound: true,
onDidReceiveLocalNotification: (int id, String? title, String? body, String? payload){
print([id, title, body, payload]);
},
defaultPresentList: true
)
);
await flutterLocalNotificationsPlugin.initialize(
initializationSettings,
onDidReceiveNotificationResponse: (response){
print(["onDidReceiveNotificationResponse", response.actionId]);
},
onDidReceiveBackgroundNotificationResponse: notificationTapBackground,
);
/// Calling notification part
await flutterLocalNotificationsPlugin.show(
99,
'title'
'notification body',
NotificationDetails(
android: AndroidNotificationDetails(),
iOS: DarwinNotificationDetails(
sound: "adzan.aiff",
interruptionLevel: InterruptionLevel.timeSensitive,
presentSound: true,
presentList: true,
presentAlert: true,
presentBadge: true,
presentBanner: true,
)
),
);agonzalezpuerta, Jan-Stepien, supratikkoley, chandrabezzo, dzulhafiz-at and 4 more
Metadata
Metadata
Assignees
Labels
No labels