<i id='GuaBw'><tr id='GuaBw'><dt id='GuaBw'><q id='GuaBw'><span id='GuaBw'><b id='GuaBw'><form id='GuaBw'><ins id='GuaBw'></ins><ul id='GuaBw'></ul><sub id='GuaBw'></sub></form><legend id='GuaBw'></legend><bdo id='GuaBw'><pre id='GuaBw'><center id='GuaBw'></center></pre></bdo></b><th id='GuaBw'></th></span></q></dt></tr></i><div id='GuaBw'><tfoot id='GuaBw'></tfoot><dl id='GuaBw'><fieldset id='GuaBw'></fieldset></dl></div>

    <bdo id='GuaBw'></bdo><ul id='GuaBw'></ul>
  1. <tfoot id='GuaBw'></tfoot>

  2. <legend id='GuaBw'><style id='GuaBw'><dir id='GuaBw'><q id='GuaBw'></q></dir></style></legend>

      <small id='GuaBw'></small><noframes id='GuaBw'>

    1. Firebase 通知是灰色的

      Firebase Notification is grey flutter(Firebase 通知是灰色的)
      1. <legend id='PORPa'><style id='PORPa'><dir id='PORPa'><q id='PORPa'></q></dir></style></legend>

          <small id='PORPa'></small><noframes id='PORPa'>

            <tbody id='PORPa'></tbody>
          <tfoot id='PORPa'></tfoot>
            <bdo id='PORPa'></bdo><ul id='PORPa'></ul>

                <i id='PORPa'><tr id='PORPa'><dt id='PORPa'><q id='PORPa'><span id='PORPa'><b id='PORPa'><form id='PORPa'><ins id='PORPa'></ins><ul id='PORPa'></ul><sub id='PORPa'></sub></form><legend id='PORPa'></legend><bdo id='PORPa'><pre id='PORPa'><center id='PORPa'></center></pre></bdo></b><th id='PORPa'></th></span></q></dt></tr></i><div id='PORPa'><tfoot id='PORPa'></tfoot><dl id='PORPa'><fieldset id='PORPa'></fieldset></dl></div>
                本文介绍了Firebase 通知是灰色的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用 Firebase Cloud Messaging 向我的 Flutter 应用发送通知.它工作正常,但我的应用程序图标通知在 Google Pixel XL 上是灰色的.我可以看到轮廓,但由于某种原因,它仍然是灰色的.我在不同的文章中读到它与 Android SDK 级别有关,但是 Flutter 中的 minSdkVersion 已经是 16(小于 21)所以我不明白为什么颜色不会显示.

                那么是否可以用颜色显示我的应用程序图标通知?

                --提前致谢

                解决方案

                希望对你有帮助.

                I'm using Firebase Cloud Messaging to send notifications to my Flutter app. It works fine but my app icon notification is grey on the Google Pixel XL. I can see the outline, but for some reason, it's still grey. I've read in different articles that it has to do with the Android SDK level, but the minSdkVersion in Flutter is already 16 (less than 21) so I don't understand why the color won't show on.

                So is it possible to show my app icon for notifications with the color?

                --Thanks in advance

                解决方案

                Here you can read:

                Customize default notification

                Custom default icon

                Setting a custom default icon allows you to specify what icon is used for notification messages if no icon is set in the notification payload. Also use the custom default icon to set the icon used by notification messages sent from the Firebase console. If no custom default icon is set and no icon is set in the notification payload, the application icon (rendered in white) is used.

                Custom default Color

                You can also define what color is used with your notification. Different android versions use this settings in different ways: Android < N use this as background color for the icon. Android >= N use this to color the icon and the app name.

                Try putting that in your AndroidManifest.xml

                <!-- Set custom default icon. This is used when no icon is set for incoming notification messages. -->
                <meta-data
                    android:name="com.google.firebase.messaging.default_notification_icon"
                    android:resource="@drawable/ic_stat_ic_notification" />
                <!-- Set color used with incoming notification messages. This is used when no color is set for the incoming notification message.  -->
                <meta-data
                    android:name="com.google.firebase.messaging.default_notification_color"
                    android:resource="@color/colorAccent" />
                

                You can find more info here.

                You also need to have your colorAccent define. You can create a colors.xml file in your res folder like that:

                <?xml version="1.0" encoding="utf-8"?>
                <resources>
                    <color name="colorAccent">#E91E63</color>
                </resources>
                

                In this folder: /android/app/src/main/res/values

                Also the icon must be in the drawable folder.

                But remember that this icon must be white with a transparent background.

                For some type of icons to be colored you need on some device sets meta-tags you already added in yuor AndroidManifest.xml and your icon must follow some specifications (must be white in a transparent background). You can try to generate one here. Give it a try. Remember to put it on drawable folder and update the manifest meta-tag icon name.

                Read also this SO question that stengthens up what I've said here.

                I've tried on the Pixel 2 emulator running API level 27:

                Hope it helps.

                这篇关于Firebase 通知是灰色的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                When does a FCM token expire?(FCM 令牌何时到期?)
                Firebase Cloud Messaging (FCM) - Launch Activity when user clicks the notification with extras(Firebase Cloud Messaging (FCM) - 当用户点击带有附加功能的通知时启动活动)
                Implement Firebase inside of a Library(在库中实现 Firebase)
                Firebase Backward compatibility with GCM(Firebase 与 GCM 的向后兼容性)
                Receiving the FCM notifications multiple times on Nougat(在 Nougat 上多次接收 FCM 通知)
                Push Notifications are delivered but didReceiveRemoteNotification is never called Swift(推送通知已交付,但 didReceiveRemoteNotification 从未被称为 Swift)

                    • <i id='HsaJ0'><tr id='HsaJ0'><dt id='HsaJ0'><q id='HsaJ0'><span id='HsaJ0'><b id='HsaJ0'><form id='HsaJ0'><ins id='HsaJ0'></ins><ul id='HsaJ0'></ul><sub id='HsaJ0'></sub></form><legend id='HsaJ0'></legend><bdo id='HsaJ0'><pre id='HsaJ0'><center id='HsaJ0'></center></pre></bdo></b><th id='HsaJ0'></th></span></q></dt></tr></i><div id='HsaJ0'><tfoot id='HsaJ0'></tfoot><dl id='HsaJ0'><fieldset id='HsaJ0'></fieldset></dl></div>

                      <small id='HsaJ0'></small><noframes id='HsaJ0'>

                          <tbody id='HsaJ0'></tbody>
                          <bdo id='HsaJ0'></bdo><ul id='HsaJ0'></ul>

                          <legend id='HsaJ0'><style id='HsaJ0'><dir id='HsaJ0'><q id='HsaJ0'></q></dir></style></legend>
                          <tfoot id='HsaJ0'></tfoot>