I am trying to send local notification in android using flutter_local_notifications and it's working nicely. But the problem is I can not show the app custom icon in notification bar. So, could anyone please help me sharing a solution. Thanks in advance! Here you go with code and image-
const notificationChannelId = 'fit_jerk';
const notificationId = 1;
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
const AndroidNotificationChannel channel = AndroidNotificationChannel(
notificationChannelId, // id
'MY FOREGROUND SERVICE', // title
description:
'This channel is used for sending daily quotation.', // description
importance: Importance.low, // importance must be at low or higher level
);
await flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.createNotificationChannel(channel);
await service.configure(
androidConfiguration: AndroidConfiguration(
onStart: onStart,
autoStart: true,
isForegroundMode: true,
notificationChannelId: notificationChannelId, // this must match with notification channel you created above.
initialNotificationTitle: 'FitJerk',
initialNotificationContent: 'Welcome to FitJerk',
foregroundServiceNotificationId: notificationId,
), iosConfiguration: IosConfiguration(),);}
await flutterLocalNotificationsPlugin.show(
notificationId,
'FitJerk',
todayQuote,
const NotificationDetails(
android: AndroidNotificationDetails(
notificationChannelId,
'MY FOREGROUND SERVICE',
icon: 'mipmap/ic_launcher',
ongoing: false,
),
),
);