即时通信 IM 自定义小图标

通知图标是移动应用在系统通知栏及状态栏的核心视觉标识,用于用户快速识别消息来源与应用品牌。小图标通常展示在顶部状态栏和通知左上角位置。这里说明各厂商通道对自定义小图标的支持情况以及如何实现该功能。

相关产品
即时通信 IM 产品页,含版本规格、价格与购买入口。

一、功能概述

效果示例

二、厂商通道支持说明

由于不同手机系统的限制,仅部分厂商通道支持自定义小图标功能,支持情况如下:

设备类型 是否支持自定义小图标
iOS 跟随应用桌面图标。
华为 支持。
荣耀 跟随应用桌面图标。
小米 跟随应用桌面图标。
vivo 跟随应用桌面图标。
OPPO 跟随应用桌面图标。
魅族 跟随应用桌面图标。
FCM 支持。

三、接入说明

AndroidiOSuni-app

四、支持厂商

华为和 Google FCM 支持自定义,其他厂商不支持自定义,默认使用 App 图标。

五、配置方法

在应用主工程的清单文件配置生效:

华为Google FCM<meta-data
android:name="com.huawei.messaging.default_notification_icon"
android:resource="@drawable/图标资源名称" /><!– [START fcm_default_icon] –>
<!– Set custom default icon. This is used when no icon is set for incoming notification messages.
See README(https://goo.gl/l4GJaQ) for more. –>
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/图标资源名称" />
<!– Set color used with incoming notification messages. This is used when no color is set for the incoming
notification message. See README(https://goo.gl/6BKBk7) for more. –>
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@android:color/white" />
<!– [END fcm_default_icon] –>

注意:FCM 图标要求:

不支持自定义,默认使用 App 图标。

说明:仅华为支持设置,其他厂商不支持,默认使用 App 图标。将小图标放到 nativeResources/android/res/drawable文件夹中,将资源文件重命名为 huawei_private_icon.png即可。如下:

赞 (0)
上一篇 4天前
下一篇 4天前