Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: User must be valid and have a name

I've set up everything to work with Firebase Messaging. Background messages are working fine. But for foreground messages, I'm facing the following error: User must be valid and have a name.

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)

It is throw in a call like this:

     AwesomeNotifications().createNotification(
        content: NotificationContent(
          id: uniqueIdInt(),
          channelKey: 'basic_channel',
          title: notification!.title,
          body: notification.body,
          notificationLayout: NotificationLayout.Messaging,
        ),
      );

Any clue?!

like image 729
Juliano Terterola Avatar asked Dec 05 '25 06:12

Juliano Terterola


1 Answers

I also had this problem and it took me a while. You need to provide a summary for it to work

Try this

AwesomeNotifications().createNotification(
    content: NotificationContent(
      id: uniqueIdInt(),
      channelKey: 'basic_channel',
      title: notification!.title,
      body: notification.body,
      summary: 'summary' // Anything you want here
      notificationLayout: NotificationLayout.Messaging,
    ),
  );

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!