我已经在Xamarin android应用程序中实现了FCM通知。当前台通知传递它时,不会调用OnMessageReceived
事件。如何获取前台消息传递事件。
使用邮递员发送 FCM 消息的代码
{
"to":"eXj6c43Jueu6pZ7J6nlPJk81plm5UGjNAwzEGDMM2WQa3EBSxJ-85GDn09wqJ6mE4Jq5nkJ1Qdo",
"notification" : {
"body" : "New homework assigned",
"OrganizationId":"619",
"click_action":"SISActivity",
"content_available" : true,
"priority" : "high",
"title" : "KG school",
"bodyText" : "great match!"
},
"data" : {
"OrganizationId":"6166",
"moduleName":"Homework",
"bodyText" : "New homework assigned",
}
}
在这里我回答我的问题。问题是,在发送通知时,我notification
有效负载以及data
,如果前台的应用程序在这种情况下OnMessageReceived
不会调用。如果您需要调用OnMessageReceived
始终不发送notification
有效负载,则只需要发送data
消息。谢谢