showNewMessageNotification static method
Implementation
static Future<void> showNewMessageNotification({
required String title,
required String body,
}) async {
try {
const AndroidNotificationDetails androidPlatformChannelSpecifics =
AndroidNotificationDetails(
'airpass_messages_channel',
'New Messages',
channelDescription: 'Notifications for new mesh network messages',
importance: Importance.max,
priority: Priority.high,
icon: '@mipmap/launcher_icon',
);
const NotificationDetails platformChannelSpecifics =
NotificationDetails(android: androidPlatformChannelSpecifics);
await _notificationsPlugin.show(
id: DateTime.now().millisecond, // random enough ID
title: title,
body: body,
notificationDetails: platformChannelSpecifics,
);
} catch (e) {
AirpassLogger.log('NotificationHelper', 'Failed to show notification: $e');
}
}