Notifications obtained from NotificationManager does not have any data. To distinguish them it is possible to send AndroidNotification.tag tr FCM see
https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidnotification
fun Context.notificationManager() =
getSystemService(NOTIFICATION_SERVICE) as NotificationManager
...
context.notificationManager()
.activeNotifications
.onEach { statusBarNotification ->
// Api should send processedNotificationsUuids as tag
// https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidnotification
if (statusBarNotification.tag in processedNotificationsUuids) {
context.notificationManager()
.cancel(statusBarNotification.tag,statusBarNotification.id)
}
}