-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
I have an incoming Firebase notification coming to my phone and if the user does not tap on it and the user re-opens the app, I want the Android notification to be removed programmatically by tag received from the notification payload.
I have used the Firebase_messaging "^1.0.3" Flutter plugin and the MessageHandler for incoming message works.
Inspecting Firebase Notification from StatusBarNotification I noticed the id_notification is always 0 while the tag is the one sent.
To remove the notification from StatusBar programmatically I have used a platform channel:
private boolean removeNotification(String tag, int idNotifica) {
boolean result = false;
NotificationManager notifManager= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notifManager.cancel(tag, idNotifica);
//notifManager.cancelAll(); --- it doesn't work too
result = true;
return result;
}
but the notification can't be removed.