0

I want to display small icon as well large icon in Notification. I can able to achieve this properly in oreo and above that. But when tested in android 6, large icon and small icon both overlaid. Below is my notification,

 NotificationCompat.Builder notification = new NotificationCompat.Builder(this, channelId)
                .setContentTitle(intent.getStringExtra("title"))
                .setContentText(intent.getStringExtra("content"))
                .setContentIntent(pendingIntent)
                .setColor(color)
                .setSmallIcon(R.drawable.small_icon)
                .setLargeIcon(BitmapFactory. decodeResource (getResources() , R.drawable.large_icon))
                .setStyle(new NotificationCompat.BigTextStyle().bigText(intent.getStringExtra("content")))
                .setSound(defaultMessageToneUri)
                .setDefaults(Notification.DEFAULT_ALL)
                .setContentIntent(pendingIntent)
                .setAutoCancel(true)
                .setCategory(NotificationCompat.CATEGORY_MESSAGE)
                .setPriority(NotificationCompat.PRIORITY_HIGH);

I am getting Notification as like mentioned in this post Android notification large icon overlaid with blank small icon How can I achieve small icon and large icon in below android oreo Thanks in advance...Any help will be appreciated....

Kousalya
  • 700
  • 10
  • 29
  • 1
    That's how notifications look on Android 5.0-6.0. That's how users expect them to look on Android 5-6. If you need something custom, here's a good start: https://developer.android.com/training/notify-user/custom-notification – Eugen Pechanec Jul 26 '20 at 14:57
  • @Eugen Pechanec okay...thank you so much for your answer...Also I would like to know about how the android notification would look like for all android versions from KitKat and so on...Where can I find that? I didn't find anything related that in android developers site...If you know where to read about that, pls share me any sites... – Kousalya Jul 26 '20 at 15:08
  • 1
    You can google "android 4.4 notification" and open Images. Same for other versions. The styles changed in 4.0, 5.0 and 7.0. Android didn't support expandable notifications until 4.1. See also [this question](https://stackoverflow.com/questions/44698440/) about notification action icons. here's a [blog post](https://android-developers.googleblog.com/2016/06/notifications-in-android-n.html) about the newest notification style. – Eugen Pechanec Jul 26 '20 at 15:15
  • @Eugen Pechanec thank you so much...that's really helpful – Kousalya Jul 26 '20 at 15:21

0 Answers0