0

hi i'm trying to send a notification using firebase console to all my app users ,when i send a notification i receive a notification with square and gray background in icon like this picture enter image description here

Manifest :

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

MyFirebaseMessagingService

private void sendNotification(String messageBody) {
        Intent intent = new Intent(this, MainActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* R    equest code */, intent,
                PendingIntent.FLAG_ONE_SHOT);
        Bitmap rawBitmap = BitmapFactory.decodeResource(getResources(),
                R.mipmap.ic_launcher);
        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setLargeIcon(rawBitmap)
                .setContentTitle("app title")
                .setContentText(messageBody)
                .setAutoCancel(true)
                .setContentIntent(pendingIntent);

        NotificationManager notificationManager =
                (NotificationManager)     getSystemService(Context.NOTIFICATION_SERVICE);

        notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
    }
}
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
MrMR
  • 279
  • 6
  • 16
  • Firebase Cloud Messaging derives the icon from the launcher icon. You can override it with a `default_notification_icon` key in your app manifest as Ian shows here: https://stackoverflow.com/questions/37325051/notification-icon-with-the-new-firebase-cloud-messaging-system/37332514#37332514 – Frank van Puffelen Aug 30 '17 at 13:18
  • @FrankvanPuffelen doesn't work still see the same icon – MrMR Aug 30 '17 at 13:44

0 Answers0