我在Xamarin安卓应用中实现了FCM通知。当提供它的前台通知未调用OnMessageReceived
事件时。如何获取前台消息传递事件。
使用Postman发送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",
}
}
答案 0 :(得分:1)
我在这里回答我的问题。问题是,在发送通知时,如果notification
有效负载与data
一起使用,则前台OnMessageReceived
中的应用将不会在此方案中调用。如果您需要致电OnMessageReceived
,请务必不要发送notification
有效负载,只需发送data
消息即可。谢谢