Pushwoosh / pushwoosh-react-native-plugin

Other
57 stars 43 forks source link

[Android] Notification color #73

Closed PierreCapo closed 5 years ago

PierreCapo commented 5 years ago

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

Could you explain to me how to do that ? Thanks in advance.

wfhm commented 5 years ago

Hi @PierreCapo,

Checking it.

wfhm commented 5 years ago

@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:

https://www.pushwoosh.com/platform-docs/pushwoosh-sdk/android-push-notifications/customizing-android-sdk-5.0#customizing-push-notifications

You can also refer to this sample factory - it changes the notification layout with a custom one with a different background color.

PierreCapo commented 5 years ago

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):

IMAGE 2019-07-16 10_26_18

Thanks for your help!

PierreCapo commented 5 years ago

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

wfhm commented 5 years ago

@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:

PierreCapo commented 5 years ago

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 :)

wfhm commented 5 years ago

@PierreCapo,

setNotificationIconBackgroundColor function is added with the latest release. Here's the short example of its usage.

PierreCapo commented 5 years ago

Thanks a lot @wfhm :)