firebase-admin-dotnet icon indicating copy to clipboard operation
firebase-admin-dotnet copied to clipboard

Invalid value at 'message.android.notification.event_time'. When im trying to send an AndroidNotification but keep getting this exception

Open InspectlyMads opened this issue 2 years ago • 0 comments

[REQUIRED] Step 2: Describe your environment

  • Operating System version: Windows 11
  • Firebase SDK version: 2.3.0
  • Firebase Product: Messaging
  • .NET version: 6
  • OS: Windows

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

What happened? How can we make the problem occur? This could be a description, log/console output, etc.

I am trying to send notification messages from my backend to the phones, which working perfectly if I just use the "Notification" in the "Message" class. However when I try to use an AndroidNotification i get the following error: FirebaseAdmin.Messaging.FirebaseMessagingException: Invalid value at 'message.android.notification.event_time' (type.googleapis.com/google.protobuf.Timestamp), Field 'event_time', Invalid time format: Failed to parse input

Relevant Code:

Message message = new Message() { Android = new AndroidConfig() { Notification = new AndroidNotification() { Title = "Test title", Body = "Body test", TitleLocKey = "added_to_project", BodyLocKey = "project", EventTimestamp = new DateTime(2011, 6, 10), }, Priority = 0, }, Data = new Dictionary<string, string>() { {"type", "1"}, }, Token = deviceToken, };

InspectlyMads avatar Aug 03 '22 10:08 InspectlyMads