I'm using the NotificationService Extension target to be able to modify push notifications before they are presented. It's working well but there is some notifications that I would like to not present to the user after they have been processed.
I'v tried to set the bestAttemptContent title and body to "" but it return the full notification.
I've also tried setting the aps["content-available"] to 1 and the body to "" but I get the same effect.
A UNNotificationServiceExtension object provides the entry point for a notification service app extension. This object lets you customize the content of a remote notification before the system delivers it to the user.
The Notification Service Extension was designed to intercept any incoming push notification our applications receive, allowing us to modify its payload content — for example, changing the title, decrypting any encrypted data or even downloading media attachments.
MoEngage Push Amplification helps marketers solve the push delivery issue and reach more potential customer devices that are cut off from FCM. With push amplification, brands can improve their push delivery rates by 40%, thereby reaching more app customers and driving more conversions.
I actually tried to achieve the same thing as you, managing what kind of notifications get delivered to a specific device using the notification service extension locally. However, I had to figure out it's by design that...
This is because Apple doesn't want you to spam a user's phone with notifications (even or especially when processed in the background and not even delivered), given this could drain battery life e. g.
You have four possible choices on what to do now:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With