Baterka
Baterka

Reputation: 3714

Notification not have icon when defining as `setSmallIcon(R.mipmap.ic_launcher)` for ForegroundService

I am building Notification for my ForegroundService on Android, but my icon is not showing:

return new NotificationCompat.Builder(this, CHANNEL_ID)
                .setContentText("Sdílení polohy je aktivní")
                .setSmallIcon(R.mipmap.ic_launcher)
                .setLargeIcon(BitmapFactory.decodeResource(this.getResources(), R.mipmap.ic_launcher))
                .build();

enter image description here

What am I doing wrong?

Upvotes: 0

Views: 1171

Answers (1)

Kasım Özdemir
Kasım Özdemir

Reputation: 5634

Create an icon set that only uses white color and put the mipmap folders, on a transparent background.You do not use any color other than white. Icon generator

And use this code for icon tint:

 .setSmallIcon(R.mipmap.notification_icon)
 .setColor(ContextCompat.getColor(context, R.color.yourColor))

Upvotes: 2

Related Questions