0

this is the code snippet I am using to show notification small icon and to set background color

NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID);
        builder.setSmallIcon(getSmallIcon());
        builder.setColor(getColor(R.color.new_theme_color));
builder.setContentTitle(getTitle());
        builder.setContentText(WebUtils.fromHtml(body));
        builder.setAutoCancel(true);
        builder.setStyle(new NotificationCompat.BigTextStyle());

this is working as expected on some devicesexpected image but on some devices the small icon looks like this not expected what I need to do to set background properly on all devices.

if I use the app icon directly that is also not working, found the solution to that problem here after changing the image to greyscale image it's working fine, but on some devices color is setting to image instead of background.

1 Answers1

0

I think your image is not transparent, you can use https://romannurik.github.io/AndroidAssetStudio/icons-notification.html to convert the notification icons, maybe some cases cannot convert because of colourful or detailed images. Hope it helps.

viethoang
  • 111
  • 3
  • thank you for the reply, but I am using transparent image only https://svgshare.com/s/vYg here is the link to that vector image, on some devices color is applying to icon instead of background. – Guru T V Jul 20 '23 at 10:58