牛轧糖中的通知图标问题

Notification icon issue in Nougat

我在我的项目中实现了 Firebase 推送通知。我遇到了一个问题,通知图标在牛轧糖中不显示,但在其他版本中显示相同的代码。 我进行了很多搜索并尝试了不同的解决方案,例如白色图标、按维度放置在 mipmap 文件夹中的图标、可绘制文件夹中的相同图标,还尝试了清单代码但没有成功,仍然在通知面板中显示灰色框。

这是我的通知代码:

 private void sendNotification(String title, String msg) {

    Uri defaultSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

    Intent intent = new Intent(getApplicationContext(), MainActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);

    NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    String NOTIFICATION_CHANNEL_ID = "101";

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        @SuppressLint("WrongConstant")
        NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "Notification", NotificationManager.IMPORTANCE_MAX);

        //Configure Notification Channel
        notificationChannel.setDescription(msg);
        notificationChannel.enableLights(true);
        notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000});
        notificationChannel.enableVibration(true);

        notificationManager.createNotificationChannel(notificationChannel);
    }

    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
            .setSmallIcon(R.drawable.ic_notification_app)
            .setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
            .setContentTitle(title)
            .setAutoCancel(true)
            .setSound(defaultSound)
            .setContentText(msg)
            .setContentIntent(pendingIntent)
            //.setStyle(style)
            // .setLargeIcon(bitmap)
            .setWhen(System.currentTimeMillis())
            .setPriority(Notification.PRIORITY_MAX);

    int id = (int) System.currentTimeMillis();
    notificationManager.notify(id, notificationBuilder.build());


}

清单文件

 <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@drawable/ic_notification_app" />
   
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_color"
        android:resource="@color/colorAccent" />

我的问题已经解决了。实际上上面的代码没有问题但是在应用程序图标中发布,图标填充渐变背景以便它在牛轧糖中总是显示灰色,为了避免这个问题我只是替换没有背景的普通图标徽标并将其转换为白色图标并且它,它的工作!!