Notifications in iOS with sound only, no badges?

76 Views Asked by At

Is it possible to send sound notifications only, without badges (locally)? I have tried setting only the sound property of UNMutableNotificationContent(), but the notification won't sound or show up without also setting at least the title-property.

You can however manually go into settings and disable the badges on the lock screen, notification center and so on. That would be ok for my app too if you could do this programmatically. Anyone know if it's possible?

1

There are 1 best solutions below

3
son On

Did you try to request with UNAuthorizationOptions? If not, do this:

UNUserNotificationCenter.current().requestAuthorization(options: [.sound]) { (granted, error) in
    //TODO
}

Updated: FYI, I think you consider background update notification, and it is handled from Backend side. The aps field on remote notification payload can contain the content-available property. Setting this property with 1 will make remote notification silent. It means there are no badge, sound, alert, etc.

Configuring a Background Update Notification