React原生通知图标无法在Samsung上运行

问题描述 投票:1回答:2

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

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

我们如何解决三星问题?

我在用:

  • 反应原生:0.56(也是0.55.4)
  • React native firebase:3.3.1
  • Android Target SDK:26

我有:

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

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
2个回答
0
投票

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


0
投票

经过几个小时我们解决了这个问题:

  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(可能还有其他)有known bug,所以至少使用12.0.0应该解决它。

© www.soinside.com 2019 - 2024. All rights reserved.