How to display notification with large and small icon below oreo version

64 Views Asked by At

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....

0

There are 0 best solutions below