Android 通知需要默认显示为展开状态而不是折叠状态。我已经尝试通过设置 PRIORITY_MAX 并且我也将样式设置为 bigpicture 但没有任何效果。请让我知道这是否可能?如果可能的话如何实现?
这是我在 kotlin 中尝试过的代码。
val notificationManager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val notificationBuilder = NotificationCompat.Builder(context,
notificationId)
setIcon(context, notificationBuilder)
notificationBuilder
.setAutoCancel(true)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setContentTitle("title")
.setContentText("Message Body")
.setStyle(NotificationCompat.BigPictureStyle()
.bigPicture(bitmap)
.bigLargeIcon(null))
.setLargeIcon(bitmap)
.setSound(defaultSoundUri())
.setContentIntent(pendingIntent)
notificationManager.notify(Sequence.nextValue(), notificationBuilder.build())