1

Sleep Cycle app manages to send a Local Notification and play a sound even when I have 'do not disturb' enabled on my phone.

How do you do this?

bandejapaisa
  • 26,576
  • 13
  • 94
  • 112

1 Answers1

1

Well, one can do by enabling "Critical alert" property in UNNotificationSetting while configuring local notification.

Apple Doc - https://developer.apple.com/documentation/usernotifications/unnotificationsettings/2963116-criticalalertsetting

When UNNotificationSetting.enabled, this property authorizes the app to play critical sounds that ignore Do Not Disturb and the device’s mute switch.

For local notifications, the system attempts to play a critical sound when the sound property of the UNNotificationContent object contains an object returned by the defaultCritical property, the criticalSoundNamed(_:) method, or a related method.

For remote notifications, the system attempts to play a critical sound when the notification’s payload contains a sound directory that contains the critical key.

Critical alerts require a special entitlement issued by Apple.

Vizllx
  • 9,135
  • 1
  • 41
  • 79