Android 不推荐使用'NotificationCompat.MessagingStyle(String userDisplayName)'的构造函数
我想为我的聊天通知生成器使用Android 不推荐使用'NotificationCompat.MessagingStyle(String userDisplayName)'的构造函数,android,android-studio,kotlin,push-notification,android-notifications,Android,Android Studio,Kotlin,Push Notification,Android Notifications,我想为我的聊天通知生成器使用MessagingStyle,但我只有发件人的用户名,我阅读了文档,发现我可以使用MessagingStyle(Person)构造函数 如何用Person实例化MessagingStyle val notificationBuilder:NotificationCompat.Builder= NotificationCompat.Builder(此为通知通道ID)。应用{ 设置显示时间(假) //设置通知样式 //setStyle(NotificationCompat
MessagingStyle
,但我只有发件人的用户名,我阅读了文档,发现我可以使用MessagingStyle(Person)
构造函数
如何用Person实例化MessagingStyle
val notificationBuilder:NotificationCompat.Builder=
NotificationCompat.Builder(此为通知通道ID)。应用{
设置显示时间(假)
//设置通知样式
//setStyle(NotificationCompat.MessagingStyle(Person))??
颜色=颜色。白色
setSmallIcon(右可绘制聊天图标)
setonlylertonce(真)
setContentIntent(contentPendingIntent)
设置正在进行(错误)
}
有关详细信息,请检查:
然后用这个作为
NotificationCompat.MessagingStyle(sender)
.addMessage("Check this out!", Date().time, sender)
.setBuilder(notificationBuilder)
NotificationCompat.MessagingStyle(sender)
.addMessage("Check this out!", Date().time, sender)
.setBuilder(notificationBuilder)