Fixed notification bug regarding to iOS
This commit is contained in:
parent
404c77b2cb
commit
ca9cf687ea
@ -30,8 +30,9 @@ class NotificationController {
|
|||||||
final NotificationService service = NotificationService();
|
final NotificationService service = NotificationService();
|
||||||
service.initializeNotifications().then((value) {
|
service.initializeNotifications().then((value) {
|
||||||
service.showNotification(
|
service.showNotification(
|
||||||
title: "Du hast $messageCount ungelesene Nachrichten!",
|
title: "Du hast $messageCount ungelesene Nachrichten!",
|
||||||
body: "In $chatCount Chats, von ${people.join(", ")}"
|
body: "In $chatCount Chats, von ${people.join(", ")}",
|
||||||
|
badgeCount: messageCount,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -39,17 +39,22 @@ class NotificationService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> showNotification({required String title, required String body}) async {
|
Future<void> showNotification({required String title, required String body, required int badgeCount}) async {
|
||||||
const AndroidNotificationDetails androidPlatformChannelSpecifics =
|
const AndroidNotificationDetails androidPlatformChannelSpecifics =
|
||||||
AndroidNotificationDetails(
|
AndroidNotificationDetails(
|
||||||
'your_channel_id',
|
'marmobile',
|
||||||
'Your Channel Name',
|
'Marianum Fulda',
|
||||||
importance: Importance.defaultImportance,
|
importance: Importance.defaultImportance,
|
||||||
priority: Priority.defaultPriority,
|
priority: Priority.defaultPriority,
|
||||||
ticker: 'ticker',
|
ticker: 'Marianum Fulda',
|
||||||
);
|
);
|
||||||
|
|
||||||
const NotificationDetails platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics);
|
const DarwinNotificationDetails iosPlatformChannelSpecifics = DarwinNotificationDetails();
|
||||||
|
|
||||||
|
const NotificationDetails platformChannelSpecifics = NotificationDetails(
|
||||||
|
android: androidPlatformChannelSpecifics,
|
||||||
|
iOS: iosPlatformChannelSpecifics
|
||||||
|
);
|
||||||
|
|
||||||
await flutterLocalNotificationsPlugin.show(
|
await flutterLocalNotificationsPlugin.show(
|
||||||
0,
|
0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user