![](/img/trans.png)
[英]Push notification received while the app is in the foreground is different from push notification received when the app is in background
[英]Android: Firebase push notification different icon while app is on foreground and another while app is on background
是的。 这确实发生了。 当从应用程序内部生成通知时,可以通过为图标设置颜色来修复它。
NotificationCompat.Builder(
this,
CHANNEL_ID
)
.setSmallIcon(//your vector)
.setColor(ContextCompat.getColor(this, //color of the icon(mostly this may be
the primary/secondary color that has been set ,according to the theme, in this
case some hex of red)))
为了保持一致,即使是在后台生成的通知,也可以在清单中写一行:
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/(your vector)” />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/(color of the icon)” />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.