0

According to https://developer.android.com/training/notify-user/build-notification#java I am creating a notification correctly.

I expect something as:

enter image description here

My code is:

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, "channel")
                .setSmallIcon(R.drawable.wesay_not)
                .setContentTitle(notification.title)
                .setContentText(notification.description)
                .setAutoCancel(true)
                .setSound(defaultSoundUri)
                .setContentIntent(pendingIntent)
                .setChannelId(context.getString(R.string.channel_id));

And the drawable is there:

enter image description here

However the device is showing the default android one, other applications seem to be showing the icon ok:

enter image description here

htafoya
  • 18,261
  • 11
  • 80
  • 104

3 Answers3

2

Probably that device you are using is xxxhdpi. and somehow it is taking default icon for those devices.

I suggest you remove your default icon from your project if you are not using it. And you can use Notification Icon Generator for generating icons for all size.

V-rund Puro-hit
  • 5,518
  • 9
  • 31
  • 50
0

Ah, I just noticed that the XXHDPI icon is 128x128 and it should be 72x72, probably that has to do

htafoya
  • 18,261
  • 11
  • 80
  • 104
0

find default icon named "wesay_not" in whole project first. If found than replace it with actual icon with folder related size.

Sohel S9
  • 246
  • 1
  • 15