I messaggi possono rappresentare diversi tipi di dati in entrata. Più comunemente,
i messaggi vengono inviati all'app dopo essere stati avviati dallo sviluppatore. I messaggi
vengono inviati anche alla tua app per rappresentare gli eventi di invio dei messaggi, gli eventi di errore di invio dei messaggi
e gli eventi di eliminazione dei messaggi. Questi eventi speciali possono essere differenziati
controllando il campo MessageType.
Messaggi eliminati
Inviato alla tua app quando il server FCM elimina i messaggi in attesa.
MessageType sarà "deleted_messages". I messaggi potrebbero essere eliminati se:
Sul server FCM sono memorizzati troppi messaggi.
Ciò può verificarsi quando i server di un'app inviano una serie di messaggi non comprimibili
ai server di FCM mentre il dispositivo è offline.
Il dispositivo non si connette da molto tempo e il server dell'app ha
inviato di recente (nelle ultime 4 settimane) un messaggio all'app su quel
dispositivo.
Ti consigliamo di eseguire una sincronizzazione completa con il server
dell'app dopo aver ricevuto questa chiamata.
Invia evento
Chiamato quando un messaggio upstream è stato inviato correttamente a FCM.
MessageType sarà "send_event".
Errore di invio
Chiamato quando si è verificato un errore durante l'invio di un messaggio upstream.
MessageType sarà "send_error".
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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\"`."]]