I have implemented FCM notifications in Xamarin android app. When foreground notifications delivering it is not calling OnMessageReceived
event. How can i get the foreground messages deliver event.
Code for sending FCM message using Postman
{
"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",
}
}
Here I am answering my question. The issue is that while sending notifications i was having notification
payload along with data
, if app in foreground OnMessageReceived
wont call in this scenario. if you need to call OnMessageReceived
always don't send notification
payload, only we need to send data
message. Thank you