我在推送通知中添加了小图标,但仍未显示。我正在使用安卓 10 模拟器。我的图标满足使用无背景的白色并存储在 mipmap 文件夹中的要求。我在stackoverflow上尝试了一些解决方案,但仍然无法正常工作。这是我的代码
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
context, CHANNEL_ID)
.setSmallIcon(R.mipmap.ic_notification)
.setContentTitle(contentTitle)
.setContentText(contentText)
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setAutoCancel(true);
我已尝试在 android manifest 上添加此代码,但仍然无法正常工作
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@mipmap/ic_notification" />
我的 targetSDK 是 29
你有没有遇到过同样的问题并解决了?