我已经设置了与 Firebase Messaging 配合使用的所有内容。后台消息工作正常。但对于前台消息,我面临以下错误:用户必须有效并且有名称。
W/System.err(15714): java.lang.RuntimeException: User must be valid and have a name.
W/System.err(15714): at android.app.Notification$MessagingStyle.validate(Notification.java:7229)
W/System.err(15714): at android.app.Notification$Builder.build(Notification.java:6088)
W/System.err(15714): at androidx.core.app.NotificationCompatBuilder.buildInternal(NotificationCompatBuilder.java:410)
W/System.err(15714): at androidx.core.app.NotificationCompatBuilder.build(NotificationCompatBuilder.java:324)
W/System.err(15714): at androidx.core.app.NotificationCompat$Builder.build(NotificationCompat.java:2430)
W/System.err(15714): at me.carda.awesome_notifications.notifications.NotificationBuilder.getNotificationBuilderFromModel(NotificationBuilder.java:425)
W/System.err(15714): at me.carda.awesome_notifications.notifications.NotificationBuilder.createNotification(NotificationBuilder.java:110)
W/System.err(15714): at me.carda.awesome_notifications.notifications.NotificationSender.showNotification(NotificationSender.java:209)
W/System.err(15714): at me.carda.awesome_notifications.notifications.NotificationSender.doInBackground(NotificationSender.java:128)
W/System.err(15714): at me.carda.awesome_notifications.notifications.NotificationSender.doInBackground(NotificationSender.java:34)
W/System.err(15714): at android.os.AsyncTask$3.call(AsyncTask.java:394)
W/System.err(15714): at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/System.err(15714): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
W/System.err(15714): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err(15714): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err(15714): at java.lang.Thread.run(Thread.java:923)
Run Code Online (Sandbox Code Playgroud)
它是这样调用的:
AwesomeNotifications().createNotification(
content: NotificationContent(
id: uniqueIdInt(),
channelKey: 'basic_channel',
title: notification!.title,
body: notification.body,
notificationLayout: NotificationLayout.Messaging,
),
);
Run Code Online (Sandbox Code Playgroud)
有什么线索吗?