【问题标题】:I can't get Flutter notification icons working我无法让 Flutter 通知图标正常工作
【发布时间】:2021-03-28 05:06:41
【问题描述】:

我在尝试使用 Firebase Messaging 在 Flutter 中获取通知图标时遇到严重问题 - 无论我尝试做什么,我都会得到一个圆形的灰色圆圈。

我使用 Android Asset builder 创建了一个颤振通知图标,它在每个 app/src/main/res/drawable-*dpi 文件夹中放置了一个适当的图标。我也尝试将它复制到主要的可绘制文件夹,但没有成功。

我还在主活动下的 app/src/main/AndroidManifest.xml 中添加了以下内容(文件名为 notification_icon)。

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

我的颤振医生是这样的:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.18363.1016], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)

有什么想法吗?我什至尝试在 Firebase 下使用 drawable 作为 android 有效负载,但仍然没有运气。

【问题讨论】:

    标签: android flutter dart firebase-cloud-messaging


    【解决方案1】:

    我之前也有同样的问题,我自己解决了这个问题。

    您应该为此添加一个透明图标。

    如果不添加透明图标会看到灰色图标

    示例透明图片:https://img.icons8.com/nolan/64/car-fire.png

    【讨论】:

    • 不幸的是,它是一个透明图标 :( 我用 Android 图标设计器制作的,它是一个透明背景上的白色图标,格式为 .png
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-07-17
    • 1970-01-01
    • 1970-01-01
    • 2016-06-19
    • 2019-11-03
    • 2016-11-27
    相关资源
    最近更新 更多