Override Previous Notifications


#1

I have my app in Expo pushing a notification when somebody sends a message, but if that person sends multiple messages a second notification is pushed.

Is there anything I can do to clear the previous notification, or simply update the notification instead of adding a second notification to the list?

Basically I need to force an override or dismiss previous notifications.

The approach I was hoping to use was to add a listener which cleared notifications before appending, but it seems that this only works when the app is in the foreground.

Is there a recommended approach to this currently?


#2

Hi @goldeelocks, you’re right that you’d need to run code in the foreground to have control over the notifications. iOS in particular has come from a place where battery life is a priority and it historically hasn’t guaranteed developers can run code when a notification arrives – this is so the OS doesn’t need to launch the app when a notification arrives.