Closed PierreCapo closed 5 years ago
Hi @PierreCapo,
Checking it.
@PierreCapo,
setNotificationIconBackgroundColor
method only sets background color of a notification icon, it does not actually change color of a notification itself., and this method is not added to the React Native plugin yet. Is that what you are looking for?
If you want to customize background color of your whole notification, you can do it in your native Android project by adding a custom NotificationFactory class as per our native API docs:
You can also refer to this sample factory - it changes the notification layout with a custom one with a different background color.
Hello @wfhm . Sorry, I get misconfused a bit, I indeed would like to change the notification color (not the background).
For instance here is what I've achieved on another project with Firebase and that we'd like to achieve on the current one with pushwoosh (coloring the esoc debug icon):
Thanks for your help!
Sorry for the bump @wfhm but we are finishing our sprint and it would be nice if I could get this information before tomorrow. Do you know how if there is a react-native API (or a java work around) color of the notification icon like in the screenshots above ?
Thanks in advance
@PierreCapo,
Just to confirm, do you mean the blue-ish color of the application icon of the esoc debug app? If so, it can be indeed set using setNotificationIconBackgroundColor method in Java. This method, however is not yet added to the React Native plugin. We will consider adding it with one of the next releases, meanwhile the easiest option for you would be adding this method to the plugin manually:
Add @ReactMethod to PushwooshPlugin.java
@ReactMethod public void setNotificationIconBackgroundColor(int color) { PushwooshNotificationSettings.setNotificationIconBackgroundColor(color); }
Add method to the plugin's index.js
//Function: setNotificationIconBackgroundColor //[android] changes notification icon background color // //Parameters: // "color" - ColorInt value for the notification icon background color // setNotificationIconBackgroundColor(color: int) { PushwooshModule.setNotificationIconBackgroundColor(color); }
Yes exactly, I'd like to achieve the blue-ish color of the application icon of the esoc debug. I'll try it in the incoming hours and see how it goes, thanks a lot :)
@PierreCapo,
setNotificationIconBackgroundColor function is added with the latest release. Here's the short example of its usage.
Thanks a lot @wfhm :)
Hello, I'm working on push notifications, and I'm not able to find in the doc any method that sets the color of push (remote) notifications on Android : https://github.com/Pushwoosh/pushwoosh-react-native-plugin/tree/master/docs
Although, in the android sdk, the method is available as
setNotificationIconBackgroundColor
: https://rawgit.com/Pushwoosh/pushwoosh-android-sdk/master/Documentation/index.htmlCould you explain to me how to do that ? Thanks in advance.