I have added firebase notification in my app . When app is running i get notification icon but when my app is in background or closed than notification icon doesn't show . Eiher it is small icon or large .
i have done many solution from Stackoverflow but all failed.
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, channelId)
.setAutoCancel(true)
.setSound(sound)
.setColor(ContextCompat.getColor(this, R.color.colorGivelife))
.setContentTitle(remoteMessage.getNotification().getTitle())
.setLargeIcon(BitmapFactory.decodeResource(this.getResources(),
R.drawable.logo))
.setContentText(remoteMessage.getNotification().getBody()).setAutoCancel(true).setContentIntent(pendingIntent);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder.setSmallIcon(R.drawable.white_logo);
builder.setColor(getResources().getColor(R.color.colorGivelife));
} else {
builder.setSmallIcon(R.drawable.logo);
}
I can get notification icon when app is in background.