Search code examples
iospush-notificationunnotificationserviceextension

Filtering iOS Push Notifications Documentation


I have an iOS app which has the Notification Service Extension to intercept incoming remote notification to update/enhance the content.

The problem here is, the notification gets displayed to user. If the app is unable to update the notification within the given time limit or due to it's logic, app wants display selective notification (and not everything it receives from the server) - In both the cases, the Notification Service Extension cannot drop a remote notification.

But then, there's this independent wiki page which talks about how the Notification Service Extension can filter out notifications from iOS 13.3 onwards.

The first step is to 'Request Notification Service Entitlement', which is only for Account holder to view. Finally, when I viewed the wiki page, I see a webpage form Apple where they ask for info like 'App Store URL', 'When your extension runs, what system and network resources does it use?' etc. and many others.

I only have a sample test app to study user notifications. I can't provide App Store URL or answer other questions like 'When your extension runs, what system and network resources does it use?'- because I don't have a full fledged app. I'm merely logging when the extension runs, to work out the code flows and understand the expectations of the OS when invoking each method.

I don't know how to proceed from here.Please let me know if I have missed something.

Has anyone faced this? Were you'll able to successfully test filtering push notifications?


Solution

  • To filter notification, you have to ask Apple for a special entitlement: https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_usernotifications_filtering

    Apple is very touchy in allowing your application to filter notifications. You must have a good reason like encrypted VoIP.

    And it takes a few weeks for Apple to answer your request.