I have made a push notification service in firebase and sending data notifications and receiving it in onMessageReceived(RemoteMessage remoteMessage)
very well,
I am well aware when to send which type of notifications and that's why I have used data notifications to get it when the app is killed.
But in my case, I do not want to send any notification when app is in Foreground mode, as onMessageReceived(RemoteMessage remoteMessage)
will always get called when the app is in Foreground mode.
How to prevent this situation?
My notification format is this..
{
"to" : "cGPhwcLbe5Y:APA91bFVAR6n9GxbDBovzd8X9nMBvKZ4Z098FzmkMGGUAuMhdps4uEof8mppUh7vrFTAsdFGzyurHa4gQ1nWgP-ncaN53ZtHziLi8YdHMEOGvtx6pA7ttCY5QhE5XKdFZ2QfX",
"data" : {
"message":"hi"
}
}