Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear all notifications in the android notification tray #1119

Open
danmdinu opened this issue Jun 6, 2019 · 2 comments
Open

Clear all notifications in the android notification tray #1119

danmdinu opened this issue Jun 6, 2019 · 2 comments

Comments

@danmdinu
Copy link

danmdinu commented Jun 6, 2019

I'm sending multiple notifications to my app. What I want to achieve is whenever a user clicks one notification then all notifications in the notification tray disspear.

I've tried adding

notification.android.setAutoCancel(true)

which does the trick for only one notification (the one which is being clicked)

I've also tried:

firebase.notifications().removeAllDeliveredNotifications()

which doesn't have any effect.

How can I achieve this?

Here's my full code:

   componentDidMount() {
   firebase.notifications().removeAllDeliveredNotifications()

  this.notificationDisplayedListener = firebase.notifications().onNotificationDisplayed((notification) => {
  });

this.notificationListener = firebase.notifications().onNotification(async (notification) => {
  // Process your notification as required
  notification.android.setAutoCancel(true)
  firebase.notifications().removeAllDeliveredNotifications()
}
async componentWillMount() {
this.notificationDisplayedListener = firebase.notifications().onNotificationDisplayed((notification) => {
});
this.notificationListener = firebase.notifications().onNotification((notification) => {
});

this.notificationDisplayedListener();
this.notificationListener();
}`
@danmdinu
Copy link
Author

danmdinu commented Sep 5, 2019

any idea anyone? ^^ thanks

@kunal-oxl
Copy link

@danmdinu were you able to solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants