flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[firebase_messaging] I can't remove incoming Firebase notifications programmatically

Open kroikie opened this issue 7 years ago • 4 comments

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.

kroikie avatar Oct 13 '19 19:10 kroikie

@faspadaro

The issue at https://github.com/flutter/flutter/issues/19076 has been closed and moved here. Future collaboration on this issue will be done here.

kroikie avatar Oct 13 '19 19:10 kroikie

Any news on this ? I can't find a way to remove FCM notification anywhere...

g-balas avatar Jan 25 '20 21:01 g-balas

Any update here?

dhuma1981 avatar Apr 20 '20 04:04 dhuma1981

Hey all 👋

As part of our roadmap (#2582) we've just shipped a complete rework of the firebase_messaging plugin that aims to solve this and many other issues.

If you can, please try out the dev release (see the migration guide for upgrading and for changes) and if you have any feedback then join in the discussion here.

Given the scope of the rework I'm going to go ahead and close this issue in favour of trying out the latest plugin in combination with a local notifications package to dismiss notifications.

Thanks everyone.

Salakar avatar Nov 05 '20 09:11 Salakar