Error: User must be valid and have a name

193

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,
    ),
  );
Share:
193
tomerpacific
Author by

tomerpacific

Updated on December 02, 2022

Comments

  • tomerpacific
    tomerpacific over 1 year

    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?!

    • tomerpacific
      tomerpacific over 2 years
      Are you using Firebase to also authenticate users on y our application?
    • Admin
      Admin over 2 years
      Hmm, no. The problem seems to be with da Awesome Notifications package, 'cause Firebase communication is working fine. The app receives que message, I can print it for debug. The error is precisely in the AwesomeNotifications().createNotification(...) call.