I’m working on an ionic mobile app and using FCM API to send push notification to this app.
When the app is in background, the notification is displayed in the system tray of the phone. When clicking on it, the user can launch the app.
However, if the user accesses the app from its icon launcher without clicking on the push notification, I wan to be able to clear all the displayed and not clicked notifications in the system tray.
After hours of head breaking I found the solution,
{
“notification”:{
“title”:“Notification title”,
“body”:“Notification body”,
“sound”:“default”,
“click_action”:“FCM_PLUGIN_ACTIVITY”,
“icon”:“fcm_push_icon”
},
“data”:{
“param1”:“value1”,
“param2”:“value2”
},
“to”:"/topics/topicExample",
“priority”:“high”,
“restricted_package_name”:""
}
"click_action":“FCM_PLUGIN_ACTIVITY” this is the mandatory parameter in the payload.