0

Hello I have implemented Push notifications in my application. It's working fine and displaying notification icon properly for the devices below nougat version.

But, It displaying notification icon as Square with color white.

Below is my code :

Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                    .setSmallIcon(R.mipmap.app_icon)
                    .setColor(ContextCompat.getColor(getApplicationContext(),R.color.white))
                    .setContentTitle(strTitle)
                    .setContentText(messageBody)
                    .setAutoCancel(true)
                    .setSound(defaultSoundUri)
                    .setContentIntent(pendingIntent);

            NotificationManager notificationManager =
                    (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

            notificationManager.notify(++NOTIFICATION_ID /* ID of notification */, notificationBuilder.build());
Mashuk Khan
  • 67
  • 11

1 Answers1

0

First of all , this is not an error. It is a change in the design with Android Nougat

For Android Nougat, you should provide rounded icon for notification. Check out this link and this for more details.

Sreehari
  • 5,621
  • 2
  • 25
  • 59