【发布时间】:2021-02-14 18:55:01
【问题描述】:
我想为我的聊天通知构建器使用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)
}
【问题讨论】:
标签: android android-studio kotlin push-notification android-notifications