You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Firebase通知图标显示为灰色,配置meta-data及制作规范图标后仍未解决

问题原因

你当前配置的默认通知图标指向的是启动图标资源@mipmap/ic_launcher,并未使用你专门生成的透明通知图标,所以显示异常。

解决步骤

  1. 首先修改AndroidManifest.xml中的meta-data配置,将资源路径替换为你生成的通知图标资源:
<meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@drawable/ic_stat_ic_launcher" />
  1. 针对Android 8.0及以上系统,需要在应用启动时初始化默认通知渠道,否则通知显示会出现异常,可在Application的onCreate方法中添加如下代码:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    NotificationChannel defaultChannel = new NotificationChannel(
        "default_channel_id",
        "通用通知",
        NotificationManager.IMPORTANCE_DEFAULT
    );
    NotificationManager manager = getSystemService(NotificationManager.class);
    manager.createNotificationChannel(defaultChannel);
}
  1. 确认你通过Firebase后台/接口发送通知时,没有单独指定通知图标参数,否则后端配置会覆盖本地Manifest的默认设置。
  2. 测试时先卸载设备上已安装的旧版本应用,再重新安装新版本,避免缓存导致配置不生效。

内容的提问来源于stack exchange,提问作者Alper Efe Sahin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.24 02:15:03