Sn0wfreeze
Sn0wfreeze

Reputation: 2031

UNUserNotificationCenter silently deliver local notification without a Banner

Hei,

I am trying to implement a feature (iOS 12+) which allows to deliver notifications silently without showing the Banner alert, but delivering it directly to the user's notification center. A bit like the new feature where a user can select that he wants to receive notifications from a specific app quietly.

I checked out the new APIs (and the old ones), but I could not find a way to solve that. I also tried to replace existing notifications by using the same identifier, but this will also present a banner.

As my app uses notifications which may help the user, but should not interrupt him I would like to control which notifications are delivered like that and which may be prominent.

If this is currently not possible, I will create feature request for that.

Regards, Alex

Upvotes: 2

Views: 465

Answers (1)

stubert
stubert

Reputation: 31

As of iOS 15, setting the UNNotificationInterruptionLevel interruption level to passive should achieve this.

let content = UNMutableNotificationContent()
content.interruptionLevel = .passive

Upvotes: 3

Related Questions