[英]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.