【问题标题】:React native notification icon not working on SamsungReact 本机通知图标不适用于三星
【发布时间】:2018-09-07 12:01:40
【问题描述】:

升级到android sdk到v26后通知图标变成了白框,我们通过使用白色/透明图标解决了这个问题。

但是,在 三星 手机上,推送通知中的小图标是绿色的安卓机器人。在推送通知使用大图标(白色/透明)的所有其他手机中,它可以完美运行。

我们如何解决三星问题?

我正在使用:

  • 反应原生:0.56(0.55.4 也是)
  • React 原生 Firebase:3.3.1
  • Android 目标 SDK:26

我有:

  • ic_launcher.png 是应用的多色徽标。
  • ic_notification.png 这是 >Lolipop 的白色/透明徽标 推送通知。

android.manifest 中的对应行:

    <application
      android:name=".MainApplication"
      android:allowBackup="true"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:theme="@style/AppTheme">
        <meta-data
          android:name = 
          "com.google.firebase.messaging.default_notification_icon"
          android:resource="@mipmap/ic_notification"
        />
        <meta-data 
          android:name = 
          "com.google.firebase.messaging.default_notification_color"
          android:resource="@color/orange" 
        />

【问题讨论】:

    标签: android react-native samsung-mobile


    【解决方案1】:

    我们在几个小时后通过以下方式解决了这个问题:

    1. 使用https://developer.android.com/studio/write/image-asset-studio#create-notification 确保图标颜色和大小正确
    2. 将 build.gradle 中的 Firebase SDK 更新为:

    implementation 'com.google.firebase:firebase-messaging:17.3.1'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    

    版本11.0.8(可能还有其他版本)有一个knownbug,所以至少使用12.0.0应该可以解决它。

    【讨论】:

      【解决方案2】:

      尝试将 react-native 版本更改为 0.55.4。较新版本的图标可能有问题。

      【讨论】:

      • 我会在评论中添加此条目,但网站阻止了这种可能性
      • 我们项目的生产版本有 0.55.4,但仍然存在同样的问题。
      猜你喜欢
      • 2019-02-10
      • 2013-02-21
      • 1970-01-01
      • 2018-06-09
      • 2023-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多