我想MessagingStyle用于我的聊天通知构建器,我只有一个来自发件人的用户名,我阅读了文档,发现我可以使用MessagingStyle(Person person)构造函数。
如何用 Person 实例化 MessagingStyle?
val notificationBuilder: NotificationCompat.Builder =
NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID).apply {
setShowWhen(false)
// Set the Notification style
// setStyle(NotificationCompat.MessagingStyle(Person)) ??
color = Color.WHITE
setSmallIcon(R.drawable.chat_notif_small_icon)
setOnlyAlertOnce(true)
setContentIntent(contentPendingIntent)
setOngoing(false)
}