Wiadomości mogą reprezentować różne rodzaje danych przychodzących. Najczęściej wiadomości są wysyłane do aplikacji po zainicjowaniu przez dewelopera. Wiadomości są też wysyłane do aplikacji, aby reprezentować zdarzenia wysłania wiadomości, zdarzenia błędów wysyłania wiadomości i zdarzenia usunięcia wiadomości. Te zdarzenia specjalne można odróżnić od siebie, sprawdzając pole MessageType.
Usunięto wiadomości
Wysyłane do aplikacji, gdy serwer FCM usuwa oczekujące wiadomości.
MessageType będzie mieć wartość "deleted_messages". Wiadomości mogą zostać usunięte, jeśli:
Na serwerze FCM jest zbyt wiele wiadomości.
Może się to zdarzyć, gdy serwery aplikacji wysyłają do serwerów FCM wiele wiadomości, których nie można zwinąć, gdy urządzenie jest offline.
Urządzenie nie było połączone z internetem od dłuższego czasu, a serwer aplikacji niedawno (w ciągu ostatnich 4 tygodni) wysłał do aplikacji na tym urządzeniu wiadomość.
Zalecamy, aby po otrzymaniu tego wywołania aplikacja przeprowadziła pełną synchronizację z serwerem aplikacji.
Wyślij zdarzenie
Wywoływana, gdy wiadomość wysłana do usługi nadrzędnej została wysłana do FCM.
MessageType będzie mieć wartość "send_event".
Błąd wysyłania
Wywoływana, gdy podczas wysyłania wiadomości do serwera wystąpił błąd.
MessageType będzie mieć wartość "send_error".
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-09-03 UTC."],[],[],null,["Receive and handle messages\n\nTo receive messages, your app must assign a callback to the\n[Firebase.Messaging.FirebaseMessaging.MessageReceived](/docs/reference/unity/class/firebase/messaging/firebase-messaging#messagereceived)\nevent handler.\n\n`MessageReceived` Event\n\nBy overriding assigning a callback to\n[Firebase.Messaging.FirebaseMessaging.MessageReceived](/docs/reference/unity/class/firebase/messaging/firebase-messaging#messagereceived)\nyou can perform actions based on the received message and get the message data: \n\n```c#\npublic void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e) {\n UnityEngine.Debug.Log(\"From: \" + e.Message.From);\n UnityEngine.Debug.Log(\"Message ID: \" + e.Message.MessageId);\n}\n```\n\nMessages can represent different kinds of incoming data. Most commonly,\nmessages are sent to the app after being initiated by the developer. Messages\nare also sent to you app to represent message sent events, message send error\nevents, and messages deleted events. These special events can be differentiated\nby checking the `MessageType` field.\n\nMessages Deleted\n\nSent to your app when the FCM server deletes pending messages.\n`MessageType` will be `\"deleted_messages\"`. Messages may be deleted if:\n\n1. Too many messages are stored on the FCM server.\n\n This can occur when an app's servers send a bunch of non-collapsible\n messages to FCM servers while the device is offline.\n2. The device hasn't connected in a long time and the app server has\n recently (within the last 4 weeks) sent a message to the app on that\n device.\n\n It is recommended that the app do a full sync with the app\n server after receiving this call.\n\nSend Event\n\nCalled when an upstream message has been successfully sent to FCM.\n`MessageType` will be `\"send_event\"`.\n\nSend Error\n\nCalled when there was an error sending an upstream message.\n`MessageType` will be `\"send_error\"`."]]