我想使用
如果没有的话,我需要使用
Android
的 Person
类来创建一个发送者的 notification
,以便在 Android P
中的 MessagingStyle
通知中显示用户图像。
然而,NotificationCompat.MessagingStyle
类不支持使用 Person
类,它似乎仅由 Notification.MessagingStyle
支持(请参见 addMessage 方法)。
是否有任何方法可以与 NotificationCompat
一起使用 Person
类?
这就是我想做的:
NotificationCompat.MessagingStyle msgStyle = NotificationCompat.MessagingStyle.extractMessagingStyleFromNotification(notification);
Person.Builder builder = new Person.Builder().setName(name).setIcon(icon);
msgStyle.addMessage(message, System.currentTimeMillis(), builder.build());
如果没有的话,我需要使用
NotificationCompat.MessagingStyle
类,因为我正在使用方法“extractMessagingStyleFromNotification”来保留通知中现有的消息,这样我只需要添加新消息。是否有办法使用Notification.MessagingStyle
实现相同的效果?