I am setting color and icon of my android notification in node.js after setting title and body it does not seem to work. and I need different notification background color and different icon for two notifications for same app that i am creating.
I have tried changing icon and color in android manifest meta tag and it works but the problem is i need separate notification icon and color for request received notification and separate notification color and icon for for new message notification. Also to mention that the code for both new request notification and new chat request notification and in same index.js file and after receiving new message, the notification that pops up is that of new friend request I don't know why.
//Request notification format.
return DeviceToken.then(result =>
{
const token_id = result.val();
const payload =
{
notification:
{
from_sender_user_id : from_sender_user_id,
title: "New Friend Request",
body: `${senderUserName} wants to connect with you`,
icon: "/requestsmall.png"
color: "#fffbd7"
}
};
//New Message notification
return Token.then(result =>
{
const tid = result.val();
const pload =
{
notification:
{
from_sender_id : from_sender_id,
title: "New Message",
body: `${senderName} sent you a message`,
icon: "chatsmall.png"
color: "#e5fafa"
}
};
I want to display now different icon and color for these two notifications but it is not working also the send message notification displays the title and body of new request notification