I'm creating a push notification system with firebase in my project.
The code that generates the push looks like this:
notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_notification)
.setColor(getResources().getColor(R.color.colorPrimary))
.setContentTitle(getResources().getString(R.string.app_name))
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
All working perfectly, icon, message, background color, but only until Android Lollipop (5.0), from then on only a white circle remains without loading the image and without the background color.
After much searching, I found answers like these:
But none of them really helped me, one of the answers says to do a validation of the SDK, like this:
private int getNotificationIcon() {
boolean useWhiteIcon = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP);
return useWhiteIcon ? R.drawable.icon_silhouette : R.drawable.ic_launcher;
}
But it does not say anything about sizes, about what I need to do to work above the Lollipop SDK.
Can someone give me a light?