Prevent show push notification using iOS Notification Service Extensions

572 views Asked by At

I know that with the iOS Notification Service Extensions it is possibile pre-process the push notifications. I'm searching for a procedure that allow me to skip the push notification is a condition is verified. For example if the push is not updated anymore I want avoid to disturb the user.

Is it possible with Notification Service Extensions, or other? I've already tried setting the body to empty string but the modify is discarded.

Thanks

1

There are 1 answers

0
pepsy On

When you receive a notification via the Notification Service Extension, you must present a notification to the user. You cannot cancel/skip it. The best you can do is setting notificationContent.sound = nil, which will silence the notification, while still presenting the banner.

Another option is to use Silent Push Notifications, so you can pre-process it and decide wether you want to show a notification or not: then use UserNotifications to present a local notification.