Android Push Notifications: Icon not displaying in notification, white square shown instead in specific devices

I have created an application with Flutter. When we receiving notification from firebase campaign messaging It’s not showing the app icon but when we are receiving from api it’s working fine no problem at all. The problem is identified on motorola phone as of now.

I’m attaching My code here Please help If you know or ever fixed this problem


void main() async {

  WidgetsFlutterBinding.ensureInitialized();
  CacheHelper.init();
  SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown,
  ]);

 
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  AwesomeNotifications().initialize(
    null, //Icon
    [
      //! initializing notification

      NotificationChannel(
        channelKey: '1',
        channelName: 'example',
        channelDescription: 'notification',
        ledColor: Colors.green,
        playSound: true,
        enableVibration: true,
        enableLights: true,
      ),
      NotificationChannel(
        channelKey: "0",
        channelName: ‘example’,
        channelDescription: 'notification',
        channelGroupKey: 'notification_group',
        ledColor: Colors.green,
        playSound: true,
        enableVibration: true,
        // locked: true,
        enableLights: true,
        importance: NotificationImportance.Max,
      ),
    ],
  );

  FirebaseMessaging.onMessage.listen((message) async {
    notificationProvider.fetchNotification();
    if (message.data['action'] == true) {
      await AwesomeNotifications().createNotification(
          content: NotificationContent(
            id: 99,
            channelKey: "0",
            title: message.data['title'],
            body: message.data['body'],
            payload: {
              'data': jsonEncode(message.data),
            },
          ),
          actionButtons: [
            NotificationActionButton(
                key: "y", label: "Yes", actionType: ActionType.SilentAction),
            NotificationActionButton(
                key: "n", label: "No", actionType: ActionType.SilentAction),
          ]);
    } else {
      await AwesomeNotifications().createNotification(
          content: NotificationContent(
              id: int.parse(message.data['notification_id']),
              channelKey: "0",
              roundedBigPicture: true,
              title: message.data['title'],
              hideLargeIconOnExpand: true,
              displayOnBackground: true,
              backgroundColor: darkgreen,
              customSound: message.data['sound'],
              payload: {
                'data': jsonEncode(message.data),
              },
              // locked: true,
              body: message.data['body'],
              bigPicture: message.data['image'],
              notificationLayout: NotificationLayout.BigPicture,
              criticalAlert: true,
              category: NotificationCategory.Recommendation,
              autoDismissible: true));
    }
  });
  FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);

  // getFCMToken().then((value) {
  //   log('FCM token : ${value}');
  //   token = value!;
  //   loginProvider.setFirebase_token(value);
  // });

  runApp(
    MultiProvider(providers: [
      ChangeNotifierProvider<ProfileDataProvider>.value(
          value: profileDataProvider),
      ChangeNotifierProvider<NotificationProvider>.value(
          value: notificationProvider),
      ChangeNotifierProvider<LoginProvider>.value(value: loginProvider),
     
    ], child: MyApp()),
  );



//! for background app notification
@pragma('vm:entry-point')
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  // log(Notification_Data: ${jsonEncode(message.data)}");
  if (message.data['action'] == true) {
    await AwesomeNotifications().createNotification(
        content: NotificationContent(
          id: 99,
          channelKey: "0",
          title: message.data['title'],
          body: message.data['body'],
          payload: {
            'data': jsonEncode(message.data),
          },
        ),
        actionButtons: [
          NotificationActionButton(
              key: "y", label: "Yes", actionType: ActionType.SilentAction),
          NotificationActionButton(
              key: "n", label: "No", actionType: ActionType.SilentAction),
        ]);
  } else {
    await AwesomeNotifications()
        .createNotification(
            content: NotificationContent(
      groupKey: 'notification_group',
      id: int.parse(message.data['notification_id']),
      channelKey: '0',
      roundedBigPicture: true,
      title: message.data['title'],
      // locked: true,
      hideLargeIconOnExpand: true,
      displayOnBackground: true,
      backgroundColor: darkgreen,
      customSound: message.data['sound'],
      autoDismissible: true,
      payload: {
        'data': jsonEncode(message.data),
      },
      body: message.data['body'],
      bigPicture: message.data['image'],
      notificationLayout: NotificationLayout.BigPicture,
      criticalAlert: true,
      category: NotificationCategory.Message,
      actionType: ActionType.Default,
    ))
        .then((value) {
      // log(Created Notificaction $value");
    }).catchError((e) {
      log(e.toString());
    });
  }
}

[enter image description here](https://i.sstatic.net/7CvzlpeK.jpg)

I want to know the cause of this issue and as It’s not happening all the devices so I don’t know where to start. I’m also sharing my gradle setting

buildscript {
    repositories {
        // ...
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
    }
    dependencies {
        // ...
        // OneSignal-Gradle-Plugin
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
    }
}


def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw  GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '4.1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'


def keystoreProperties = new Properties()
   def keystorePropertiesFile = rootProject.file('key.properties')
   if (keystorePropertiesFile.exists()) {
       keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
   }

android {
    packagingOptions {
            pickFirst 'lib/x86/libc++_shared.so'
            pickFirst 'lib/x86_64/libc++_shared.so'
            pickFirst 'lib/armeabi-v7a/libc++_shared.so'
            pickFirst 'lib/arm64-v8a/libc++_shared.so'
    }
    compileSdkVersion 34
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.farm.android"
        minSdkVersion 21
        targetSdkVersion 34
        versionCode 54
        // versionCode 7 old  
        // targetSdkVersion flutter.targetSdkVersion
        // versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }


    signingConfigs {
        release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            proguardFiles getDefaultProguardFile(
                    'proguard-android-optimize.txt'),
                    'proguard-rules.pro'
            minifyEnabled true
            shrinkResources true
            signingConfig signingConfigs.release

        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:29.1.0')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.facebook.android:facebook-android-sdk:latest.release'
    implementation 'com.google.firebase:firebase-messaging:20.1.0'
    implementation 'com.onesignal:OneSignal:3.12.7'
    implementation 'com.android.support:multidex:2.0.1'
       
}

My manifest setting

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.farmdss.android">
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
        <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="https" />
        </intent>
        <intent>
            <action android:name="android.intent.action.DIAL" />
            <data android:scheme="tel" />
        </intent>
        <intent>
            <action android:name="android.intent.action.SEND" />
            <data android:mimeType="*/*" />
        </intent>
    </queries>
   <application
        android:allowBackup="false"
        android:label=“Farm"
        android:name="androidx.multidex.MultiDexApplication"
        android:usesCleartextTraffic="true"
        android:requestLegacyExternalStorage="true"
        android:icon="@mipmap/launcher_icon">
        
                    
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTask"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <intent-filter>
            
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data
        android:host="farm.page.link"
        android:scheme="https"/>
</intent-filter>
            <intent-filter>
    <action android:name="FLUTTER_NOTIFICATION_CLICK" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
        </activity>
        <activity
  android:name="com.yalantis.ucrop.UCropActivity"
  android:screenOrientation="portrait"
  android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>


        <intent-filter>
       
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="@string/fb_login_protocol_scheme" />
        </intent-filter>
    </activity>
<meta-data
    android:name="io.flutter.embedding.android.EnableImpeller"
    android:value="true" />
   <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
              <meta-data
                android:name="com.google.firebase.messaging.default_notification_channel_id"
                android:value="pushnotificationapp"/>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
            <!-- <meta-data android:name="com.onesignal.NotificationOpened.DEFAULT" android:value="DISABLE" /> -->
    </application>
</manifest>

New contributor

Soumyajit Das is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật