Apparently on Android your app can install a "listener" that gets notified when the device receives a push notification, and then decide whether to display a push notification alert or not.
An app I'm working on has feature flags that let us turn parts of the app on and off, and there is a chance that a feature that's accessible from a push notification might need to be turned off. It would be good if we could check a feature flag when the system receives a push notification and simply "swallow" the push if the feature is turned off, without displaying a system notification alert to the user at all. If the feature is turned on we'd like to continue and display a system notification which the user can tap (or not) as normal.
iOS has silent push notifications, but those are intended to be handled purely in the background, and are supposed to be completed in 30 seconds or less. They also are given a lower priority than other push notifications and might not get delivered.
You can intercept the push notification using a notification service extension and it is possible for that to swallow the resulting user notification.
However in order for that to work the extension needs to have the com.apple.developer.usernotifications.filtering entitlement.
This entitlement has to be applied for via your Apple developer account, I don't know what criteria Apple use to decide if your application to obtain the notification will be granted or not.