1

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,
          ),
        ),
      );

enter image description here

enter image description here

  • Does this answer your question? [How to Change the Android Notification Icon/Status Bar Icon for Push-notification in #flutter?](https://stackoverflow.com/questions/46676014/how-to-change-the-android-notification-icon-status-bar-icon-for-push-notificatio) – Esmaeil Ahmadipour Jan 14 '23 at 17:01

0 Answers0