gpt4 book ai didi

flutter - 如何设置 Flutter 自定义通知图标?,因为 fcm 的 flutter 中没有默认通知图标

转载 作者:行者123 更新时间:2023-12-01 23:07:16 24 4
gpt4 key购买 nike

当我使用 fcm(firebase 云消息传递)时,我想为我的 flutter 应用程序设置一个自定义通知图标以显示在我的通知面板中,但只出现一个灰色圆圈,没有图标。

最佳答案

找了半天终于找到答案了:

  1. 使用此 tool 创建自定义通知图标.
  2. 将生成的图标列表粘贴到 android/app/src/main/res 中。
  3. 转到您的 list android/app/src/main/AndroidManifest.xml 并在 application(不是事件)标签中添加以下元数据:
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/colorPrimary" />
  1. 如果您在 res/values 中没有 colors.xml,请创建一个: enter image description here
  2. 完成!它应该有效,如果无效请告诉我。

问题讨论is here .

关于flutter - 如何设置 Flutter 自定义通知图标?,因为 fcm 的 flutter 中没有默认通知图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70649051/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com