使用 Firebase 通知作为通知图标的灰色方块 [英] Grey square as notification icon using Firebase notifications

查看:31
本文介绍了使用 Firebase 通知作为通知图标的灰色方块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 Firebase Cloud Messaging 集成到我的 Android 应用程序中.但是当应用程序在后台或关闭时,Firebase 通知会显示为灰色方形图标,而不是我的应用程序的启动器图标.

I am attempting to integrate Firebase Cloud Messaging into my android app. But when the app is in the background or closed, Firebase notification is displayed with grey square icon instead of my application's launcher icon.

如何在不实现 Firebase 服务器 API 和发送数据消息的情况下将通知图标作为我的应用程序徽标?

How could I make the notification icon to be my application logo, without implementing Firebase server API and sending data messages?

推荐答案

从 Firebase 9.8.0 开始,可以通过在 Manifest 中添加相关信息来更改此图标:

From Firebase 9.8.0 it is possible to change this icon, by adding info about this in Manifest:

<meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@drawable/ic_stat_ic_notification" />
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_color"
        android:resource="@color/colorAccent" />

您可以在此处找到示例:

Example you will find here:

https://github.com/firebase/quickstart-android/blob/master/messaging/app/src/main/AndroidManifest.xml

这篇关于使用 Firebase 通知作为通知图标的灰色方块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆