0

Firebase notification : App icon shown as notification icon by default even set other icon as setSmallIcon()

In manifest

  <application
    android:name=".ApplicationRoot"
    android:allowBackup="false"
    android:icon="@drawable/ic_stat_name"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:requestLegacyExternalStorage="true"
    android:supportsRtl="true"
    
    android:usesCleartextTraffic="true"
    tools:ignore="AllowBackup,GoogleAppIndexingWarning"
    tools:replace="android:allowBackup,android:icon"
    tools:targetApi="m">
             ....

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

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

in coding

    var notificationBuilder = NotificationCompat.Builder(this, channelId)
        .setSmallIcon(R.drawable.ic_stat_name)
        .setContentTitle(title)
        .setContentText(messageBody)
        .setPriority(NotificationCompat.PRIORITY_DEFAULT)

Instead of showing R.drawable.ic_stat_name am getting my app logo in the notification.

sasikumar
  • 12,540
  • 3
  • 28
  • 48

0 Answers0