Los mensajes pueden representar diferentes tipos de datos entrantes. Por lo general, los mensajes se envían a la app después de que el desarrollador los inicia. También se envían mensajes a tu app para representar eventos de mensajes enviados, de error de envío de mensajes y de mensajes borrados. Puedes reconocer estos eventos especiales si revisas el campo MessageType.
Mensajes borrados
Se envían a tu app cuando el servidor de FCM borra los mensajes pendientes.
El MessageType será "deleted_messages". Es posible que se borren los mensajes debido a lo siguiente:
Hay demasiados mensajes almacenados en el servidor de FCM.
Esto puede ocurrir cuando los servidores de una app envían varios mensajes
no contraíbles a los servidores de FCM mientras el dispositivo está sin conexión.
El dispositivo no se ha conectado en mucho tiempo y el servidor de apps envió recientemente (en las últimas 4 semanas) un mensaje a la app en ese dispositivo.
Se recomienda que la app realice una sincronización completa con el servidor de apps después de recibir esta llamada.
Evento de envío
Se llama cuando un mensaje upstream se envía correctamente a FCM.
El MessageType será "send_event".
Error de envío
Se llama cuando se produce un error de envío de un mensaje ascendente.
El MessageType será "send_error".
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-05 (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\"`."]]