androidflutternotificationsfirebase-cloud-messagingflutter-local-notification

Notification logo not showing in expanded view in android


I'm using the flutter_local_notifications package to show foreground notifications on Android. On most devices, the notification icon (logo) appears correctly both in collapsed and expanded views. However, on the Redmi C13(Android 14), the logo does not appear in the expanded notification view — it's just blank space where the icon should be.

Here's the code I'm using to display the notification:

Future<void> showRegularNotification(
  RemoteNotification notification, 
  RemoteMessage message,
) async {
  await _localNotifications.show(
    notification.hashCode,
    notification.title,
    notification.body,
    NotificationDetails(
      android: AndroidNotificationDetails(
        _androidChannel.id,
        _androidChannel.name,
        channelDescription: _androidChannel.description,
        icon: '@mipmap/ic_launcher',
      ),
    ),
    payload: jsonEncode(message.toMap()),
  );
}

I've confirmed that:

enter image description hereenter image description here

I have attached some screen shot references.


Solution

  • Yes, In some devices getting issue so follow below steps

    1. Check Icon is proper or not

      1. Icon should be white-only transparent and PNG format .

      2. Icon should be in the in res/drawable folder.

      3. For Ex. android/app/src/main/res/drawable/demo.png.

    2. set icon in notification service class like below

      1.  const NotificationDetails(
            android: AndroidNotificationDetails(
              'test_channel_id',
              'Test Channel',
              icon: 'ic_stat_notify', // same as in initialization
              importance: Importance.high,
              priority: Priority.high,
            ),
          ),
        
    3. Set below 2 android permission in Android Menifest File

      1. <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

      2. <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

    hope it helps!