0

I am trying to use Firebase Cloud Messaging to make an instant message app.

In the document it said sending the notification if the app is in background, it will shows the notification on the notification bar. Otherwise it will fire up OnMessageReceived and not showing the notification in the bar,.

Is there any way in Xamarin I can have the control to show / not show the notification when the app is in background?

For example, when people send messages in the chatroom and User A has the app in background, I don't want to show notification to the User A ( because the people in the chatroom is having conversation that not really related to User A, so User A don't want to get the notification spam and want it silent).

The User A will only interest to the conversation when the app is in foreground and want to see the message.

King Chan
  • 4,212
  • 10
  • 46
  • 78
  • @AL. I think my question is little different, I am not asking how to handle notification in background, more like I want to not have to handle and not displaying any notification to the user device while is in background. I found the answer (not the one that marked as answer in the link). As long as I don't send Notification payload, it will not appears as notification. – King Chan May 10 '18 at 02:15
  • @AL. By the way, thank you :D – King Chan May 10 '18 at 02:51
  • It all depends on your payload. But on how I saw it, you could just handle the notification from the background, check if it is -- show the notification, if not, do nothing. Let me know of the link, I could replace the tagged post. Cheers! – AL. May 10 '18 at 04:25
  • @AL. Not so sure how I can get the link, it is in the link you provided, but answer with 93 vote and starts with " 93 down vote To make firebase library to call your onMessageReceived() in the following cases" – King Chan May 12 '18 at 05:08
  • If it's in the same link, it should be fine. – AL. May 12 '18 at 06:54

0 Answers0