react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

Android app notification icon showing background white

Open anuj-njoshi opened this issue 4 years ago • 13 comments

Using above android 9.0 > version Notification icon converted to transparent Still showing white icon background.

anuj-njoshi avatar Feb 28 '20 10:02 anuj-njoshi

any updates how to solve this

yehiaemad avatar Apr 12 '20 18:04 yehiaemad

Hi Did you try to change the parameter of:

        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"
                    android:resource="@color/white"/> <!-- or @android:color/{name} to use a standard color -->

Like:

@android:color/transparent

Dallas62 avatar Apr 12 '20 18:04 Dallas62

@Dallas62 transparent doesn't seem to work on Android 10 (Pixel 3 on screenshot) However, it there is no issue for Android 8

image

I would like to figure out how to get rid of this, but, unfortunately, you should rebuild Android app whenever manifest is changed, so it makes it quite long to test. Btw, why resource is stricted to be a color? It's not stricted by the system afaik, so you should be able to use any type of resource, e.g mipmap icons.

artyorsh avatar Apr 15 '20 15:04 artyorsh

Hi @artyorsh I took a look at the library code, it seems you can remove :

        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"
                    android:resource="@color/white"/> <!-- or @android:color/{name} to use a standard color -->

The color property should not be set this way. Actually the library force the resource to be color, if you have a bit of time to test with mipmaps, this could be great 😃

Dallas62 avatar Apr 15 '20 15:04 Dallas62

Do you mean this whole tag is not required anymore?

artyorsh avatar Apr 15 '20 15:04 artyorsh

getNotificationColor use of getNotificationColor

If you don't set it on the manifest, this will use the default Android value, I hope this is will resolve the issue. No exception will be throw in the app, it will ignore the color, expect if it's set in the notification.

Dallas62 avatar Apr 15 '20 15:04 Dallas62

According to documents. You need to:

Create an asset that only uses white pixels, on a transparent background. It's important to not use any color other than white.

Your asset must be called ic_notification.png Your assets must be placed inside mipmap-* directories and not drawable-* (as @wuppious mentioned).

Your asset dimensions (in pixels): mipmap-mdpi - 24x24 mipmap-hdpi - 36x36 mipmap-xhdpi - 48x48 mipmap-xxhdpi - 72x72 mipmap-xxxhdpi - 96x96

Then you can pass color: 'what you need' for icon in notification object.

yehiaemad avatar Apr 20 '20 18:04 yehiaemad

According to documents. You need to:

Create an asset that only uses white pixels, on a transparent background. It's important to not use any color other than white.

Your asset must be called ic_notification.png Your assets must be placed inside mipmap-* directories and not drawable-* (as @wuppious mentioned).

Your asset dimensions (in pixels): mipmap-mdpi - 24x24 mipmap-hdpi - 36x36 mipmap-xhdpi - 48x48 mipmap-xxhdpi - 72x72 mipmap-xxxhdpi - 96x96

It's working. The icon has a white or transparent background color by default. There is a way to assign a custom background color to the ic_notification.png? or we need to specify it somewhere else? The idea is to show the ic_notification with the color of our branding, and not just white/transparent.

RRGT19 avatar Jul 18 '20 12:07 RRGT19

@RRGT19 Try passing color: ' what you need' in notification object.

yehiaemad avatar Jul 19 '20 12:07 yehiaemad

Hello @RRGT19 ... I actually add in new notification icon under the mipmap-folders and named ic_notification.png I'm still getting a white icon when receiving notification.

One thing I realized is, when adding my image to https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=image&source.space.trim=1&source.space.pad=0&name=ic_stat_ic_launcher it returns me a blank white image as well. Not sure if this is an image issue or what.

Update 1.0

I think my issue is because of .. not providing a image which is ONLY IN WHITE. My logo is having some colors, will test and re-update here. Read more here

Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon. You should assume that these icons will be alpha-only. The system draws notification icons in white and action icons in dark gray

TommyLeong avatar Oct 15 '20 08:10 TommyLeong

@RRGT19 Try passing color: ' what you need' in notification object.

Please i have the same the issue how to pass the color?

umagloire99 avatar Nov 17 '20 15:11 umagloire99

I used this method found on a SO thread with a white version of my logo. Then the color that you set will apply in the notification center.

CptMaumau avatar May 20 '21 10:05 CptMaumau

I am also able to set the icon properly but not able to pass the color, can someone guide me what is the next step after generating and and pasting icon in respective folders

Hello @RRGT19 ... I actually add in new notification icon under the mipmap-folders and named ic_notification.png I'm still getting a white icon when receiving notification.

One thing I realized is, when adding my image to https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=image&source.space.trim=1&source.space.pad=0&name=ic_stat_ic_launcher it returns me a blank white image as well. Not sure if this is an image issue or what.

Update 1.0

I think my issue is because of .. not providing a image which is ONLY IN WHITE. My logo is having some colors, will test and re-update here. Read more here

Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon. You should assume that these icons will be alpha-only. The system draws notification icons in white and action icons in dark gray

scoutNinjaswapnil avatar Dec 26 '23 05:12 scoutNinjaswapnil