我正在使用以下代码构建通知构建器,以便通过Firebase云功能在android设备上接收通知。我成功收到通知。但是通知的上下文并不完全可见,如您在图像中所见。
在左上角的图标显示为灰色,没有显示实际的图标,并且文本没有完全显示。
我应该如何纠正上述问题?
通知生成器
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, ADMIN_CHANNEL_ID)
.setSmallIcon(R.drawable.finalicon)
.setLargeIcon(largeIcon)
.setContentTitle(messageTitle)
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(notificationSoundUri)
.setContentIntent(pendingIntent);
您应使用NotificationCompat.BigTextStyle
Helper类,用于生成包含很多文字。如果平台不提供大幅面通知,此方法无效。用户将始终看到普通通知视图。
NotificationCompat.BigTextStyle