javascript - 在 node.js 中更改 FCM 通知的颜色和图标

我在设置标题和正文后在 node.js 中设置我的 android 通知的颜色和图标它似乎不起作用。对于我正在创建的同一应用程序的两个通知,我需要不同的通知背景颜色和不同的图标。

我已经尝试更改 android list 元标记中的图标和颜色并且它有效但问题是我需要单独的通知图标和颜色用于请求收到的通知以及单独的通知颜色和图标用于新消息通知。还要提一下,新请求通知和新聊天请求通知的代码在同一个index.js文件中,收到新消息后,弹出的通知是新 friend 请求通知,我不知道为什么。

//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"
            }
        };

我现在想为这两个通知显示不同的图标和颜色,但它不起作用,发送消息通知也显示新请求通知的标题和正文

最佳答案

据我所知,这完全取决于您在项目中使用的扩展。 Firebase 的每个扩展都不支持所有功能。即使您直接从 Firebase 控制台发送 FCM 消息,它也不会重定向到所需的页面。很多天后,我找到了一个 extension它支持所有功能。只需在您的项目中安装并尝试并使用它。希望它对你有用。
用于安装扩展 npm i cordova-plugin-firebasex

https://stackoverflow.com/questions/56660160/

相关文章:

flutter - 抽屉菜单 - 侧面的子菜单

javascript - 在 React-native 应用程序中使用 Fable 中的 nativ

reactjs - React Router - 父级在导航子路由时重新渲染

c# - 标签助手 asp-route- 不工作 - Razor Pages(.Net Core 3

amazon-web-services - 是否可以向 InputPath 添加新的键/值?

apache-spark - 如何将处理程序附加到 sparkUI

html - css 比例变换和滤镜模糊的问题

google-cloud-platform - 使用 Terraformer\Terraform 克

reactjs - React hook 等待上一个调用完成

react-native - ScrollView : content image is cropp